1. 18 11月, 2010 18 次提交
    • J
      Provide 'git merge --abort' as a synonym to 'git reset --merge' · 35d2fffd
      Johan Herland 提交于
      Teach 'git merge' the --abort option, which verifies the existence of
      MERGE_HEAD and then invokes 'git reset --merge' to abort the current
      in-progress merge and attempt to reconstruct the pre-merge state.
      
      The reason for adding this option is to provide a user interface for
      aborting an in-progress merge that is consistent with the interface
      for aborting a rebase ('git rebase --abort'), aborting the application
      of a patch series ('git am --abort'), and aborting an in-progress notes
      merge ('git notes merge --abort').
      
      The patch includes documentation and testcases that explain and verify
      the various scenarios in which 'git merge --abort' can run. The
      testcases also document the cases in which 'git merge --abort' is
      unable to correctly restore the pre-merge state (look for the '###'
      comments towards the bottom of t/t7609-merge-abort.sh).
      
      This patch has been improved by the following contributions:
      - Jonathan Nieder: Move test documentation into test_description
      
      Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      35d2fffd
    • J
      cmd_merge(): Parse options before checking MERGE_HEAD · 2a22c1b3
      Johan Herland 提交于
      Reorder the initial part of builtin/merge.c:cmd_merge() so that command-line
      options are parsed _before_ we load the index and check for MERGE_HEAD
      (and exits if it exists). This does not change the behaviour of 'git merge',
      but is needed in preparation for the implementation of 'git merge --abort'
      (which requires MERGE_HEAD to be present).
      
      This patch has been improved by the following contributions:
      - Junio C Hamano: fixup minor style issues
      
      Thanks-to: Junio C Hamano <gitster@pobox.com>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2a22c1b3
    • J
      Provide 'git notes get-ref' to easily retrieve current notes ref · 618cd757
      Johan Herland 提交于
      Script may use 'git notes get-ref' to easily retrieve the current notes ref.
      Suggested-by: NJonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      618cd757
    • J
      git notes merge: Add testcases for merging notes trees at different fanouts · 305ddd44
      Johan Herland 提交于
      Notes trees may exist at different fanout levels internally. This
      implementation detail should not be visible to the user, and it should
      certainly not affect the merging of notes tree.
      
      This patch adds testcases verifying the correctness of 'git notes merge'
      when merging notes trees at different fanout levels.
      
      This patch has been improved by the following contributions:
      - Junio C Hamano: Portability: Don't string-compare 'wc -l' output
      
      Thanks-to: Junio C Hamano <gitster@pobox.com>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      305ddd44
    • J
      git notes merge: Add another auto-resolving strategy: "cat_sort_uniq" · a6a09095
      Johan Herland 提交于
      This new strategy is similar to "concatenate", but in addition to
      concatenating the two note candidates, this strategy sorts the resulting
      lines, and removes duplicate lines from the result. This is equivalent to
      applying the "cat | sort | uniq" shell pipeline to the two note candidates.
      
      This strategy is useful if the notes follow a line-based format where one
      wants to avoid duplicate lines in the merge result.
      
      Note that if either of the note candidates contain duplicate lines _prior_
      to the merge, these will also be removed by this merge strategy.
      
      The patch also contains tests and documentation for the new strategy.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a6a09095
    • J
      git notes merge: --commit should fail if underlying notes ref has moved · 6cfd6a9d
      Johan Herland 提交于
      When manually resolving a notes merge, if the merging ref has moved since
      the merge started, we should fail to complete the merge, and alert the user
      to what's going on.
      
      This situation may arise if you start a 'git notes merge' which results in
      conflicts, and you then update the current notes ref (using for example
      'git notes add/copy/amend/edit/remove/prune', 'git update-ref', etc.),
      before you get around to resolving the notes conflicts and calling
      'git notes merge --commit'.
      
      We detect this situation by comparing the first parent of the partial merge
      commit (which was created when the merge started) to the current value of the
      merging notes ref (pointed to by the .git/NOTES_MERGE_REF symref).
      
      If we don't fail in this situation, the notes merge commit would overwrite
      the updated notes ref, thus losing the changes that happened in the meantime.
      
      The patch includes a testcase verifying that we fail correctly in this
      situation.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6cfd6a9d
    • J
      git notes merge: List conflicting notes in notes merge commit message · 443259cf
      Johan Herland 提交于
      This brings notes merge in line with regular merge's behaviour.
      
      This patch has been improved by the following contributions:
      - Ævar Arnfjörð Bjarmason: Don't use C99 comments.
      
      Thanks-to: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      443259cf
    • J
      git notes merge: Manual conflict resolution, part 2/2 · 6abb3655
      Johan Herland 提交于
      When the notes merge conflicts in .git/NOTES_MERGE_WORKTREE have been
      resolved, we need to record a new notes commit on the appropriate notes
      ref with the resolved notes.
      
      This patch implements 'git notes merge --commit' which the user should
      run after resolving conflicts in the notes merge worktree. This command
      finalizes the notes merge by recombining the partial notes tree from
      part 1 with the now-resolved conflicts in the notes merge worktree in a
      merge commit, and updating the appropriate ref to this merge commit.
      
      In order to correctly finalize the merge, we need to keep track of three
      things:
      
      - The partial merge result from part 1, containing the auto-merged notes.
        This is now stored into a ref called .git/NOTES_MERGE_PARTIAL.
      - The unmerged notes. These are already stored in
        .git/NOTES_MERGE_WORKTREE, thanks to part 1.
      - The notes ref to be updated by the finalized merge result. This is now
        stored in a symref called .git/NOTES_MERGE_REF.
      
      In addition to "git notes merge --commit", which uses the above details
      to create the finalized notes merge commit, this patch also implements
      "git notes merge --reset", which aborts the ongoing notes merge by simply
      removing the files/directory described above.
      
      FTR, "git notes merge --commit" reuses "git notes merge --reset" to remove
      the information described above (.git/NOTES_MERGE_*) after the notes merge
      have been successfully finalized.
      
      The patch also contains documentation and testcases for the two new options.
      
      This patch has been improved by the following contributions:
      - Ævar Arnfjörð Bjarmason: Fix nonsense sentence in --commit description
      - Sverre Rabbelier: Rename --reset to --abort
      
      Thanks-to: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
      Thanks-to: Sverre Rabbelier <srabbelier@gmail.com>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6abb3655
    • J
      git notes merge: Manual conflict resolution, part 1/2 · 809f38c8
      Johan Herland 提交于
      Conflicts (that are to be resolved manually) are written into a special-
      purpose working tree, located at .git/NOTES_MERGE_WORKTREE. Within this
      directory, conflicting notes entries are stored (with conflict markers
      produced by ll_merge()) using the SHA1 of the annotated object. The
      .git/NOTES_MERGE_WORKTREE directory will only contain the _conflicting_
      note entries. The non-conflicting note entries (aka. the partial merge
      result) are stored in 'local_tree', and the SHA1 of the resulting commit
      is written to 'result_sha1'. The return value from notes_merge() is -1.
      
      The user is told to edit the files within the .git/NOTES_MERGE_WORKTREE
      directory in order to resolve the conflicts.
      
      The patch also contains documentation and testcases for the correct setup
      of .git/NOTES_MERGE_WORKTREE.
      
      The next part will recombine the partial notes merge result with the
      resolved conflicts in .git/NOTES_MERGE_WORKTREE to produce the complete
      merge result.
      
      This patch has been improved by the following contributions:
      - Jonathan Nieder: Use trace_printf(...) instead of OUTPUT(o, 5, ...)
      
      Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      809f38c8
    • J
      Documentation: Preliminary docs on 'git notes merge' · 00f03061
      Johan Herland 提交于
      This patch has been improved by the following contributions:
      - Stephen Boyd: Use "automatically resolves" instead of "auto-resolves"
      - Stephen Boyd: Remove unbalanced '('
      
      Thanks-to: Stephen Boyd <bebarino@gmail.com>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      00f03061
    • J
      git notes merge: Add automatic conflict resolvers (ours, theirs, union) · 3228e671
      Johan Herland 提交于
      The new -s/--strategy command-line option to 'git notes merge' allow the user
      to choose how notes merge conflicts should be resolved. There are four valid
      strategies to choose from:
      
      1. "manual" (the default): This will let the user manually resolve conflicts.
         This option currently fails with an error message. It will be implemented
         properly in future patches.
      
      2. "ours": This automatically chooses the local version of a conflict, and
         discards the remote version.
      
      3. "theirs": This automatically chooses the remote version of a conflict, and
         discards the local version.
      
      4. "union": This automatically resolves the conflict by appending the remote
         version to the local version.
      
      The strategies are implemented using the combine_notes_* functions from the
      notes.h API.
      
      The patch also includes testcases verifying the correct implementation of
      these strategies.
      
      This patch has been improved by the following contributions:
      - Jonathan Nieder: Future-proof by always checking add_note() return value
      - Stephen Boyd: Use test_commit
      - Stephen Boyd: Use correct option name
      
      Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
      Thanks-to: Stephen Boyd <bebarino@gmail.com>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3228e671
    • J
      git notes merge: Handle real, non-conflicting notes merges · 2085b16a
      Johan Herland 提交于
      This continuation of the 'git notes merge' implementation teaches notes-merge
      to properly do real merges between notes trees: Two diffs are performed, one
      from $base to $remote, and another from $base to $local. The paths in each
      diff are normalized to SHA1 object names. The two diffs are then consolidated
      into a single list of change pairs to be evaluated. Each change pair consist
      of:
      
        - The annotated object's SHA1
        - The $base SHA1 (i.e. the common ancestor notes for this object)
        - The $local SHA1 (i.e. the current notes for this object)
        - The $remote SHA1 (i.e. the to-be-merged notes for this object)
      
      From the pair ($base -> $local, $base -> $remote), we can determine the merge
      result using regular 3-way rules. If conflicts are encountered in this
      process, we fail loudly and exit (conflict handling to be added in a future
      patch), If we can complete the merge without conflicts, the resulting
      notes tree is committed, and the current notes ref updated.
      
      The patch includes added testcases verifying that we can successfully do real
      conflict-less merges.
      
      This patch has been improved by the following contributions:
      - Jonathan Nieder: Future-proof by always checking add_note() return value
      - Stephen Boyd: Use test_commit
      - Jonathan Nieder: Use trace_printf(...) instead of OUTPUT(o, 5, ...)
      - Junio C Hamano: fixup minor style issues
      
      Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
      Thanks-to: Stephen Boyd <bebarino@gmail.com>
      Thanks-to: Junio C Hamano <gitster@pobox.com>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2085b16a
    • J
      builtin/notes.c: Refactor creation of notes commits. · 56881843
      Johan Herland 提交于
      Create new function create_notes_commit() which is slightly more general than
      commit_notes() (accepts multiple commit parents and does not auto-update the
      notes ref). This function will be used by the notes-merge functionality in
      future patches.
      
      Also rewrite builtin/notes.c:commit_notes() to reuse this new function.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      56881843
    • J
      git notes merge: Initial implementation handling trivial merges only · 75ef3f4a
      Johan Herland 提交于
      This initial implementation of 'git notes merge' only handles the trivial
      merge cases (i.e. where the merge is either a no-op, or a fast-forward).
      
      The patch includes testcases for these trivial merge cases.
      
      Future patches will extend the functionality of 'git notes merge'.
      
      This patch has been improved by the following contributions:
      - Stephen Boyd: Simplify argc logic
      - Stephen Boyd: Use test_commit
      - Ævar Arnfjörð Bjarmason: Don't use C99 comments.
      - Jonathan Nieder: Add constants for common verbosity values
      - Jonathan Nieder: Use trace_printf(...) instead of OUTPUT(o, 5, ...)
      - Jonathan Nieder: Remove extraneous show() function
      - Jonathan Nieder: Clarify handling of empty/missing notes ref in notes_merge()
      - Junio C Hamano: fixup minor style issues
      
      Thanks-to: Stephen Boyd <bebarino@gmail.com>
      Thanks-to: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
      Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
      Thanks-to: Junio C Hamano <gitster@pobox.com>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      75ef3f4a
    • J
      builtin/notes.c: Split notes ref DWIMmery into a separate function · 8ef313e1
      Johan Herland 提交于
      expand_notes_ref() is a new function that performs the DWIM transformation
      of "foo" -> "refs/notes/foo" where notes refs are expected.
      
      This is done in preparation for future patches which will also need this
      DWIM functionality.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8ef313e1
    • J
      notes.c: Use two newlines (instead of one) when concatenating notes · d4990c4b
      Johan Herland 提交于
      When using combine_notes_concatenate() to concatenate notes, it currently
      ensures exactly one newline character between the given notes. However,
      when using builtin/notes.c:create_note() to concatenate notes (e.g. by
      'git notes append'), it adds a newline character to the trailing newline
      of the preceding notes object, thus resulting in _two_ newlines (aka. a
      blank line) separating contents of the two notes.
      
      This patch brings combine_notes_concatenate() into consistency with
      builtin/notes.c:create_note(), by ensuring exactly _two_ newline characters
      between concatenated notes.
      
      The patch also changes a few notes-related selftests accordingly.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d4990c4b
    • J
      (trivial) t3303: Indent with tabs instead of spaces for consistency · 32a36b4d
      Johan Herland 提交于
      The rest of the file uses tabs for indenting. Fix the one function
      that doesn't.
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      32a36b4d
    • J
      notes.h/c: Propagate combine_notes_fn return value to add_note() and beyond · 180619a5
      Johan Herland 提交于
      The combine_notes_fn functions uses a non-zero return value to indicate
      failure. However, this return value was converted to a call to die()
      in note_tree_insert().
      
      Instead, propagate this return value out to add_note(), and return it
      from there to enable the caller to handle errors appropriately.
      
      Existing add_note() callers are updated to die() upon failure, thus
      preserving the current behaviour. The only exceptions are copy_note()
      and notes_cache_put() where we are able to propagate the add_note()
      return value instead.
      
      This patch has been improved by the following contributions:
      - Jonathan Nieder: Future-proof by always checking add_note() return value
      - Jonathan Nieder: Improve clarity of final if-condition in note_tree_insert()
      
      Thanks-to: Jonathan Nieder <jrnieder@gmail.com>
      Signed-off-by: NJohan Herland <johan@herland.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      180619a5
  2. 11 11月, 2010 5 次提交
  3. 10 8月, 2010 4 次提交
  4. 07 8月, 2010 2 次提交
  5. 06 8月, 2010 1 次提交
  6. 04 8月, 2010 3 次提交
    • J
      Merge branch 'sv/maint-diff-q-clear-fix' into maint · bb89e84f
      Junio C Hamano 提交于
      * sv/maint-diff-q-clear-fix:
        Fix DIFF_QUEUE_CLEAR refactoring
      bb89e84f
    • J
      Merge branch 'rr/svn-fe' into maint · 7b6e6b3f
      Junio C Hamano 提交于
      * rr/svn-fe:
        contrib/svn-fe: Add the svn-fe target to .gitignore
        contrib/svn-fe: Fix IncludePath
      7b6e6b3f
    • J
      Merge branch 'pt/git-gui' into maint · e9aa2412
      Junio C Hamano 提交于
      * pt/git-gui:
        git-gui: fix size and position of window panes on startup
        git-gui: mc cannot be used before msgcat has been loaded
        git-gui: use textconv filter for diff and blame
        git-gui: Avoid using the <<Copy>> binding as a menu accelerator on win32
        git-gui: fix shortcut creation on cygwin
        git-gui: fix PATH environment for mingw development environment
        git-gui: fix usage of _gitworktree when creating shortcut for windows
        git-gui: fix "Explore Working Copy" for Windows again
        git-gui: fix usage of themed widgets variable
        git-gui: Handle failure of core.worktree to identify the working directory.
        git-gui: check whether systems nice command works or disable it
      e9aa2412
  7. 03 8月, 2010 7 次提交