1. 23 4月, 2014 1 次提交
  2. 08 4月, 2014 1 次提交
  3. 25 3月, 2014 1 次提交
    • J
      parse-options: multi-word argh should use dash to separate words · e703d711
      Junio C Hamano 提交于
      "When you need to use space, use dash" is a strange way to say that
      you must not use a space.  Because it is more common for the command
      line descriptions to use dashed-multi-words, you do not even want to
      use spaces in these places.  Rephrase the documentation to avoid
      this strangeness.
      
      Fix a few existing multi-word argument help strings, i.e.
      
       - GPG key-ids given to -S/--gpg-sign are "key-id";
       - Refs used for storing notes are "notes-ref"; and
       - Expiry timestamps given to --expire are "expiry-date".
      
      and update the corresponding documentation pages.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e703d711
  4. 19 3月, 2014 2 次提交
  5. 25 2月, 2014 1 次提交
  6. 18 1月, 2014 1 次提交
  7. 06 12月, 2013 1 次提交
    • C
      replace {pre,suf}fixcmp() with {starts,ends}_with() · 59556548
      Christian Couder 提交于
      Leaving only the function definitions and declarations so that any
      new topic in flight can still make use of the old functions, replace
      existing uses of the prefixcmp() and suffixcmp() with new API
      functions.
      
      The change can be recreated by mechanically applying this:
      
          $ git grep -l -e prefixcmp -e suffixcmp -- \*.c |
            grep -v strbuf\\.c |
            xargs perl -pi -e '
              s|!prefixcmp\(|starts_with\(|g;
              s|prefixcmp\(|!starts_with\(|g;
              s|!suffixcmp\(|ends_with\(|g;
              s|suffixcmp\(|!ends_with\(|g;
            '
      
      on the result of preparatory changes in this series.
      Signed-off-by: NChristian Couder <chriscool@tuxfamily.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      59556548
  8. 01 11月, 2013 1 次提交
  9. 05 9月, 2013 1 次提交
  10. 06 8月, 2013 1 次提交
  11. 10 7月, 2013 1 次提交
    • N
      Convert "struct cache_entry *" to "const ..." wherever possible · 9c5e6c80
      Nguyễn Thái Ngọc Duy 提交于
      I attempted to make index_state->cache[] a "const struct cache_entry **"
      to find out how existing entries in index are modified and where. The
      question I have is what do we do if we really need to keep track of on-disk
      changes in the index. The result is
      
       - diff-lib.c: setting CE_UPTODATE
      
       - name-hash.c: setting CE_HASHED
      
       - preload-index.c, read-cache.c, unpack-trees.c and
         builtin/update-index: obvious
      
       - entry.c: write_entry() may refresh the checked out entry via
         fill_stat_cache_info(). This causes "non-const struct cache_entry
         *" in builtin/apply.c, builtin/checkout-index.c and
         builtin/checkout.c
      
       - builtin/ls-files.c: --with-tree changes stagemask and may set
         CE_UPDATE
      
      Of these, write_entry() and its call sites are probably most
      interesting because it modifies on-disk info. But this is stat info
      and can be retrieved via refresh, at least for porcelain
      commands. Other just uses ce_flags for local purposes.
      
      So, keeping track of "dirty" entries is just a matter of setting a
      flag in index modification functions exposed by read-cache.c. Except
      unpack-trees, the rest of the code base does not do anything funny
      behind read-cache's back.
      
      The actual patch is less valueable than the summary above. But if
      anyone wants to re-identify the above sites. Applying this patch, then
      this:
      
          diff --git a/cache.h b/cache.h
          index 430d021..1692891 100644
          --- a/cache.h
          +++ b/cache.h
          @@ -267,7 +267,7 @@ static inline unsigned int canon_mode(unsigned int mode)
           #define cache_entry_size(len) (offsetof(struct cache_entry,name) + (len) + 1)
      
           struct index_state {
          -	struct cache_entry **cache;
          +	const struct cache_entry **cache;
           	unsigned int version;
           	unsigned int cache_nr, cache_alloc, cache_changed;
           	struct string_list *resolve_undo;
      
      will help quickly identify them without bogus warnings.
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9c5e6c80
  12. 04 7月, 2013 1 次提交
  13. 03 7月, 2013 1 次提交
    • M
      merge: handle --ff/--no-ff/--ff-only as a tri-state option · a54841e9
      Miklos Vajna 提交于
      These three options mean "favor fast-forwarding when possible,
      without creating an unnecessary merge", "never fast-forward and
      always create a merge commit even when the commit being merged is a
      strict descendant", and "we do not want to create any merge commit;
      update only when the merged commit is a strict descendant".
      
      They are "pick one out of these three possibilities" options, and
      correspond to "merge.ff" configuration that is tri-state (yes, no
      and only).
      
      However, the implementation did not follow the usual convention for
      the command line options (later one wins, and command line overrides
      what is in the configuration).
      
      Fix this by consolidating two variables (fast_forward_only and
      allow_fast_forward) used in the implementation into one enum that
      can take one of the three possible values.
      Signed-off-by: NMiklos Vajna <vmiklos@suse.cz>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a54841e9
  14. 09 5月, 2013 1 次提交
  15. 01 4月, 2013 2 次提交
  16. 20 3月, 2013 1 次提交
  17. 17 1月, 2013 1 次提交
    • J
      Allow custom "comment char" · eff80a9f
      Junio C Hamano 提交于
      Some users do want to write a line that begin with a pound sign, #,
      in their commit log message.  Many tracking system recognise
      a token of #<bugid> form, for example.
      
      The support we offer these use cases is not very friendly to the end
      users.  They have a choice between
      
       - Don't do it.  Avoid such a line by rewrapping or indenting; and
      
       - Use --cleanup=whitespace but remove all the hint lines we add.
      
      Give them a way to set a custom comment char, e.g.
      
          $ git -c core.commentchar="%" commit
      
      so that they do not have to do either of the two workarounds.
      
      [jc: although I started the topic, all the tests and documentation
      updates, many of the call sites of the new strbuf_add_commented_*()
      functions, and the change to git-submodule.sh scripted Porcelain are
      from Ralf.]
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      Signed-off-by: NRalf Thielow <ralf.thielow@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      eff80a9f
  18. 04 1月, 2013 1 次提交
    • A
      merge: Honor prepare-commit-msg return code · 3e4141d0
      Antoine Pelisse 提交于
      65969d43 (merge: honor prepare-commit-msg hook, 2011-02-14) tried to
      make "git commit" and "git merge" consistent, because a merge that
      required user assistance has to be concluded with "git commit", but
      back then only "git commit" triggered prepare-commit-msg hook.
      
      When it added a call to run the prepare-commit-msg hook, however, it
      forgot to check the exit code from the hook like "git commit" does,
      and ended up replacing one inconsistency with another.
      
      When prepare-commit-msg hook that is run from "git merge" exits with
      a non-zero status, abort the commit.
      Signed-off-by: NAntoine Pelisse <apelisse@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3e4141d0
  19. 29 12月, 2012 1 次提交
    • J
      merge --no-edit: do not credit people involved in the side branch · 9bcbb1c2
      Junio C Hamano 提交于
      The credit lines "By" and "Via" to credit authors and committers for
      their contributions on the side branch are meant as a hint to the
      integrator to decide whom to mention in the log message text.  After
      the integrator saves the message in the editor, they are meant to go
      away and that is why they are commented out.
      
      When a merge is recorded without editing the generated message,
      however, its contents do not go through the normal stripspace()
      and these lines are left in the merge.
      
      Stop producing them when we know the merge is going to be recorded
      without editing, i.e. when --no-edit is given.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9bcbb1c2
  20. 29 10月, 2012 1 次提交
  21. 21 8月, 2012 1 次提交
  22. 04 8月, 2012 1 次提交
    • T
      diff_setup_done(): return void · 28452655
      Thomas Rast 提交于
      diff_setup_done() has historically returned an error code, but lost
      the last nonzero return in 943d5b73 (allow diff.renamelimit to be set
      regardless of -M/-C, 2006-08-09).  The callers were in a pretty
      confused state: some actually checked for the return code, and some
      did not.
      
      Let it return void, and patch all callers to take this into account.
      This conveniently also gets rid of a handful of different(!) error
      messages that could never be triggered anyway.
      
      Note that the function can still die().
      Signed-off-by: NThomas Rast <trast@student.ethz.ch>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      28452655
  23. 25 5月, 2012 1 次提交
    • J
      ident: rename IDENT_ERROR_ON_NO_NAME to IDENT_STRICT · f9bc573f
      Jeff King 提交于
      Callers who ask for ERROR_ON_NO_NAME are not so much
      concerned that the name will be blank (because, after all,
      we will fall back to using the username), but rather it is a
      check to make sure that low-quality identities do not end up
      in things like commit messages or emails (whereas it is OK
      for them to end up in things like reflogs).
      
      When future commits add more quality checks on the identity,
      each of these callers would want to use those checks, too.
      Rather than modify each of them later to add a new flag,
      let's refactor the flag.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f9bc573f
  24. 18 4月, 2012 3 次提交
  25. 21 3月, 2012 1 次提交
    • J
      merge: backport GIT_MERGE_AUTOEDIT support · d387868a
      Junio C Hamano 提交于
      Even though 1.7.9.x series does not open the editor by default
      when merging in general, it does do so in one occassion: when
      merging an annotated tag. And worse yet, there is no good way
      for older scripts to decline this.
      
      Backport the support for GIT_MERGE_AUTOEDIT environment variable
      from 1.7.10 track to help those stuck on 1.7.9.x maintenance
      track.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d387868a
  26. 02 3月, 2012 2 次提交
  27. 24 2月, 2012 1 次提交
    • J
      merge: do not trust fstat(2) too much when checking interactiveness · d46f476c
      Junio C Hamano 提交于
      The heuristic used by "git merge" to decide if it automatically gives an
      editor upon clean automerge is to see if the standard input and the
      standard output is the same device and is a tty, we are in an interactive
      session.  "The same device" test was done by comparing fstat(2) result on
      the two file descriptors (and they must match), and we asked isatty() only
      for the standard input (we insist that they are the same device and there
      is no point asking tty-ness of the standard output).
      
      The stat(2) emulation in the Windows port however does not give a usable
      value in the st_ino field, so even if the standard output is connected to
      something different from the standard input, "The same device" test may
      incorrectly return true. To accomodate it, add another isatty() check for
      the standard output stream as well.
      Reported-by: NErik Faye-Lund <kusmabite@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d46f476c
  28. 10 2月, 2012 1 次提交
  29. 06 2月, 2012 1 次提交
    • J
      merge: do not create a signed tag merge under --ff-only option · b5c9f1c1
      Junio C Hamano 提交于
      Starting at release v1.7.9, if you ask to merge a signed tag, "git merge"
      always creates a merge commit, even when the tag points at a commit that
      happens to be a descendant of your current commit.
      
      Unfortunately, this interacts rather badly for people who use --ff-only to
      make sure that their branch is free of local developments. It used to be
      possible to say:
      
      	$ git checkout -b frotz v1.7.9~30
              $ git merge --ff-only v1.7.9
      
      and expect that the resulting tip of frotz branch matches v1.7.9^0 (aka
      the commit tagged as v1.7.9), but this fails with the updated Git with:
      
      	fatal: Not possible to fast-forward, aborting.
      
      because a merge that merges v1.7.9 tag to v1.7.9~30 cannot be created by
      fast forwarding.
      
      We could teach users that now they have to do
      
      	$ git merge --ff-only v1.7.9^0
      
      but it is far more pleasant for users if we DWIMmed this ourselves.
      
      When an integrator pulls in a topic from a lieutenant via a signed tag,
      even when the work done by the lieutenant happens to fast-forward, the
      integrator wants to have a merge record, so the integrator will not be
      asking for --ff-only when running "git pull" in such a case. Therefore,
      this change should not regress the support for the use case v1.7.9 wanted
      to add.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b5c9f1c1
  30. 01 2月, 2012 1 次提交
    • T
      merge: add instructions to the commit message when editing · f26af3fc
      Thomas Rast 提交于
      Before f8246281 (merge: use editor by default in interactive sessions,
      2012-01-10), git-merge only started an editor if the user explicitly
      asked for it with --edit.  Thus it seemed unlikely that the user would
      need extra guidance.
      
      After f8246281 the _normal_ thing is to start an editor.  Give at least
      an indication of why we are doing it.
      
      The sentence about justification is one of the few things about
      standard git that are not agnostic to the workflow that the user
      chose.  However, f8246281 was proposed by Linus specifically to
      discourage users from merging unrelated upstream progress into topic
      branches.  So we may as well take another step in the same direction.
      Signed-off-by: NThomas Rast <trast@student.ethz.ch>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f26af3fc
  31. 24 1月, 2012 1 次提交
    • J
      merge: use editor by default in interactive sessions · f8246281
      Junio C Hamano 提交于
      Traditionally, a cleanly resolved merge was committed by "git merge" using
      the auto-generated merge commit log message without invoking the editor.
      
      After 5 years of use in the field, it turns out that people perform too
      many unjustified merges of the upstream history into their topic branches.
      These merges are not just useless, but they are often not explained well,
      and making the end result unreadable when it gets time for merging their
      history back to their upstream.
      
      Earlier we added the "--edit" option to the command, so that people can
      edit the log message to explain and justify their merge commits. Let's
      take it one step further and spawn the editor by default when we are in an
      interactive session (i.e. the standard input and the standard output are
      pointing at the same tty device).
      
      There may be existing scripts that leave the standard input and the
      standard output of the "git merge" connected to whatever environment the
      scripts were started, and such invocation might trigger the above
      "interactive session" heuristics.  GIT_MERGE_AUTOEDIT environment variable
      can be set to "no" at the beginning of such scripts to use the historical
      behaviour while the script runs.
      
      Note that this backward compatibility is meant only for scripts, and we
      deliberately do *not* support "merge.edit = yes/no/auto" configuration
      option to allow people to keep the historical behaviour.
      Suggested-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f8246281
  32. 16 12月, 2011 2 次提交
  33. 14 12月, 2011 1 次提交
  34. 06 12月, 2011 1 次提交
    • N
      Copy resolve_ref() return value for longer use · d5a35c11
      Nguyễn Thái Ngọc Duy 提交于
      resolve_ref() may return a pointer to a static buffer. Callers that
      use this value longer than a couple of statements should copy the
      value to avoid some hidden resolve_ref() call that may change the
      static buffer's value.
      
      The bug found by Tony Wang <wwwjfy@gmail.com> in builtin/merge.c
      demonstrates this. The first call is in cmd_merge()
      
      branch = resolve_ref("HEAD", head_sha1, 0, &flag);
      
      Then deep in lookup_commit_or_die() a few lines after, resolve_ref()
      may be called again and destroy "branch".
      
      lookup_commit_or_die
       lookup_commit_reference
        lookup_commit_reference_gently
         parse_object
          lookup_replace_object
           do_lookup_replace_object
            prepare_replace_object
             for_each_replace_ref
              do_for_each_ref
               get_loose_refs
                get_ref_dir
                 get_ref_dir
                  resolve_ref
      
      All call sites are checked and made sure that xstrdup() is called if
      the value should be saved.
      Signed-off-by: NNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d5a35c11