Code

git.git
13 years agoMerge branch 'jk/maint-apply-no-binary'
Junio C Hamano [Wed, 17 Nov 2010 23:01:18 +0000 (15:01 -0800)]
Merge branch 'jk/maint-apply-no-binary'

* jk/maint-apply-no-binary:
  apply: don't segfault on binary files with missing data

13 years agoMerge branch 'jk/push-progress'
Junio C Hamano [Wed, 17 Nov 2010 23:01:00 +0000 (15:01 -0800)]
Merge branch 'jk/push-progress'

* jk/push-progress:
  push: pass --progress down to git-pack-objects
  t5523-push-upstream: test progress messages
  t5523-push-upstream: add function to ensure fresh upstream repo
  test_terminal: ensure redirections work reliably
  test_terminal: catch use without TTY prerequisite
  test-lib: allow test code to check the list of declared prerequisites
  tests: test terminal output to both stdout and stderr
  tests: factor out terminal handling from t7006

13 years agoMerge branch 'tr/maint-merge-file-subdir'
Junio C Hamano [Wed, 17 Nov 2010 23:00:56 +0000 (15:00 -0800)]
Merge branch 'tr/maint-merge-file-subdir'

* tr/maint-merge-file-subdir:
  merge-file: correctly find files when called in subdir
  prefix_filename(): safely handle the case where pfx_len=0

13 years agoMerge branch 'jn/send-pack-error'
Junio C Hamano [Wed, 17 Nov 2010 23:00:51 +0000 (15:00 -0800)]
Merge branch 'jn/send-pack-error'

* jn/send-pack-error:
  send-pack: avoid redundant "pack-objects died with strange error"

13 years agoMerge branch 'mg/make-prove'
Junio C Hamano [Wed, 17 Nov 2010 23:00:46 +0000 (15:00 -0800)]
Merge branch 'mg/make-prove'

* mg/make-prove:
  test: allow running the tests under "prove"

13 years agoMerge branch 'kb/completion-checkout'
Junio C Hamano [Wed, 17 Nov 2010 23:00:42 +0000 (15:00 -0800)]
Merge branch 'kb/completion-checkout'

* kb/completion-checkout:
  completion: Support the DWIM mode for git checkout

13 years agoMerge branch 'sg/completion'
Junio C Hamano [Wed, 17 Nov 2010 23:00:11 +0000 (15:00 -0800)]
Merge branch 'sg/completion'

* sg/completion:
  bash: support pretty format aliases
  bash: support more 'git notes' subcommands and their options
  bash: not all 'git bisect' subcommands make sense when not bisecting
  bash: offer refs for 'git bisect start'

13 years agoMerge branch 'sg/bisect'
Junio C Hamano [Wed, 17 Nov 2010 23:00:03 +0000 (15:00 -0800)]
Merge branch 'sg/bisect'

* sg/bisect:
  bisect: check for mandatory argument of 'bisect replay'
  bisect: improve error msg of 'bisect reset' when original HEAD is deleted
  bisect: improve error message of 'bisect log' while not bisecting

13 years agoMerge branch 'ak/submodule-sync'
Junio C Hamano [Wed, 17 Nov 2010 22:59:54 +0000 (14:59 -0800)]
Merge branch 'ak/submodule-sync'

* ak/submodule-sync:
  submodule sync: Update "submodule.<name>.url" for empty directories

13 years agoMerge branch 'jk/maint-rev-list-nul'
Junio C Hamano [Wed, 17 Nov 2010 22:59:33 +0000 (14:59 -0800)]
Merge branch 'jk/maint-rev-list-nul'

* jk/maint-rev-list-nul:
  rev-list: handle %x00 NUL in user format

13 years agoMerge branch 'ks/no-textconv-symlink'
Junio C Hamano [Wed, 17 Nov 2010 22:59:27 +0000 (14:59 -0800)]
Merge branch 'ks/no-textconv-symlink'

* ks/no-textconv-symlink:
  blame,cat-file --textconv: Don't assume mode is ``S_IFREF | 0664''
  blame,cat-file: Demonstrate --textconv is wrongly running converter on symlinks
  blame,cat-file: Prepare --textconv tests for correctly-failing conversion program

13 years agoMerge branch 'jn/gitweb-test'
Junio C Hamano [Wed, 17 Nov 2010 22:59:22 +0000 (14:59 -0800)]
Merge branch 'jn/gitweb-test'

* jn/gitweb-test:
  gitweb/Makefile: Include gitweb/config.mak
  gitweb/Makefile: Add 'test' and 'test-installed' targets
  t/gitweb-lib.sh: Add support for GITWEB_TEST_INSTALLED
  gitweb: Move call to evaluate_git_version after evaluate_gitweb_config

13 years agoMerge branch 'cb/diff-fname-optim'
Junio C Hamano [Wed, 17 Nov 2010 22:59:16 +0000 (14:59 -0800)]
Merge branch 'cb/diff-fname-optim'

* cb/diff-fname-optim:
  diff: avoid repeated scanning while looking for funcname
  do not search functions for patch ID
  add rebase patch id tests

13 years agoMerge branch 'jk/no-textconv-symlink'
Junio C Hamano [Wed, 17 Nov 2010 22:59:10 +0000 (14:59 -0800)]
Merge branch 'jk/no-textconv-symlink'

* jk/no-textconv-symlink:
  diff: don't use pathname-based diff drivers for symlinks

13 years agoMerge branch 'dk/maint-blame-el'
Junio C Hamano [Wed, 17 Nov 2010 22:59:04 +0000 (14:59 -0800)]
Merge branch 'dk/maint-blame-el'

* dk/maint-blame-el:
  git-blame.el: Add (require 'format-spec)

13 years agoMerge branch 'maint'
Junio C Hamano [Wed, 17 Nov 2010 21:57:58 +0000 (13:57 -0800)]
Merge branch 'maint'

* maint:
  clean: remove redundant variable baselen
  Documentation/git-pull: clarify configuration
  Document that rev-list --graph triggers parent rewriting.
  clean: avoid quoting twice
  document sigchain api
  Keep together options controlling the behaviour of diffcore-rename.
  t3402: test "rebase -s<strategy> -X<opt>"

13 years agot6022: Use -eq not = to test output of wc -l
Brian Gernhardt [Mon, 8 Nov 2010 21:29:26 +0000 (16:29 -0500)]
t6022: Use -eq not = to test output of wc -l

When comparing numbers such as "3" to "$(wc -l)", we should check for
numerical equality using -eq instead of string equality using = because
some implementations of wc output extra whitespace.

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoclean: remove redundant variable baselen
Nguyễn Thái Ngọc Duy [Mon, 15 Nov 2010 06:42:44 +0000 (13:42 +0700)]
clean: remove redundant variable baselen

baselen used to be the result of common_prefix() when it was made
builtin. Since 1d8842d (Add 'fill_directory()' helper function for
directory traversal - 2009-05-14), its value will always be
zero. Remove it because it's no longer variable.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoProvide 'git merge --abort' as a synonym to 'git reset --merge'
Johan Herland [Tue, 9 Nov 2010 21:49:59 +0000 (22:49 +0100)]
Provide 'git merge --abort' as a synonym to 'git reset --merge'

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocmd_merge(): Parse options before checking MERGE_HEAD
Johan Herland [Tue, 9 Nov 2010 21:49:58 +0000 (22:49 +0100)]
cmd_merge(): Parse options before checking MERGE_HEAD

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoProvide 'git notes get-ref' to easily retrieve current notes ref
Johan Herland [Tue, 9 Nov 2010 21:49:57 +0000 (22:49 +0100)]
Provide 'git notes get-ref' to easily retrieve current notes ref

Script may use 'git notes get-ref' to easily retrieve the current notes ref.

Suggested-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit notes merge: Add testcases for merging notes trees at different fanouts
Johan Herland [Tue, 9 Nov 2010 21:49:56 +0000 (22:49 +0100)]
git notes merge: Add testcases for merging notes trees at different fanouts

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit notes merge: Add another auto-resolving strategy: "cat_sort_uniq"
Johan Herland [Sun, 14 Nov 2010 23:57:17 +0000 (00:57 +0100)]
git notes merge: Add another auto-resolving strategy: "cat_sort_uniq"

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit notes merge: --commit should fail if underlying notes ref has moved
Johan Herland [Tue, 9 Nov 2010 21:49:54 +0000 (22:49 +0100)]
git notes merge: --commit should fail if underlying notes ref has moved

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit notes merge: List conflicting notes in notes merge commit message
Johan Herland [Tue, 9 Nov 2010 21:49:53 +0000 (22:49 +0100)]
git notes merge: List conflicting notes in notes merge commit message

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit notes merge: Manual conflict resolution, part 2/2
Johan Herland [Tue, 9 Nov 2010 21:49:52 +0000 (22:49 +0100)]
git notes merge: Manual conflict resolution, part 2/2

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit notes merge: Manual conflict resolution, part 1/2
Johan Herland [Tue, 9 Nov 2010 21:49:51 +0000 (22:49 +0100)]
git notes merge: Manual conflict resolution, part 1/2

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: Preliminary docs on 'git notes merge'
Johan Herland [Tue, 9 Nov 2010 21:49:50 +0000 (22:49 +0100)]
Documentation: Preliminary docs on 'git notes merge'

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit notes merge: Add automatic conflict resolvers (ours, theirs, union)
Johan Herland [Sun, 14 Nov 2010 23:55:12 +0000 (00:55 +0100)]
git notes merge: Add automatic conflict resolvers (ours, theirs, union)

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit notes merge: Handle real, non-conflicting notes merges
Johan Herland [Sun, 14 Nov 2010 23:54:11 +0000 (00:54 +0100)]
git notes merge: Handle real, non-conflicting notes merges

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobuiltin/notes.c: Refactor creation of notes commits.
Johan Herland [Tue, 9 Nov 2010 21:49:47 +0000 (22:49 +0100)]
builtin/notes.c: Refactor creation of notes commits.

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit notes merge: Initial implementation handling trivial merges only
Johan Herland [Tue, 9 Nov 2010 21:49:46 +0000 (22:49 +0100)]
git notes merge: Initial implementation handling trivial merges only

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobuiltin/notes.c: Split notes ref DWIMmery into a separate function
Johan Herland [Tue, 9 Nov 2010 21:49:45 +0000 (22:49 +0100)]
builtin/notes.c: Split notes ref DWIMmery into a separate function

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agonotes.c: Use two newlines (instead of one) when concatenating notes
Johan Herland [Tue, 9 Nov 2010 21:49:44 +0000 (22:49 +0100)]
notes.c: Use two newlines (instead of one) when concatenating notes

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years ago(trivial) t3303: Indent with tabs instead of spaces for consistency
Johan Herland [Tue, 9 Nov 2010 21:49:43 +0000 (22:49 +0100)]
(trivial) t3303: Indent with tabs instead of spaces for consistency

The rest of the file uses tabs for indenting. Fix the one function
that doesn't.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agonotes.h/c: Propagate combine_notes_fn return value to add_note() and beyond
Johan Herland [Sun, 14 Nov 2010 23:52:26 +0000 (00:52 +0100)]
notes.h/c: Propagate combine_notes_fn return value to add_note() and beyond

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: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'mz/maint-rebase-X-fix' into maint
Junio C Hamano [Wed, 17 Nov 2010 21:18:19 +0000 (13:18 -0800)]
Merge branch 'mz/maint-rebase-X-fix' into maint

* mz/maint-rebase-X-fix:
  t3402: test "rebase -s<strategy> -X<opt>"

13 years agoDocumentation/git-pull: clarify configuration
Martin von Zweigbergk [Fri, 12 Nov 2010 18:55:58 +0000 (19:55 +0100)]
Documentation/git-pull: clarify configuration

The sentence about 'branch.<name>.rebase' refers to the first sentence
in the paragraph and not to the sentence about avoiding rebasing
non-local changes. Clarify this.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocument that rev-list --graph triggers parent rewriting.
Yann Dirson [Fri, 12 Nov 2010 08:48:58 +0000 (09:48 +0100)]
Document that rev-list --graph triggers parent rewriting.

This may help to understand why --graph causes more comments to
be selected.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix username and password extraction from HTTP URLs
Gabriel Corona [Sun, 14 Nov 2010 01:51:15 +0000 (02:51 +0100)]
Fix username and password extraction from HTTP URLs

Change the authentification initialisation to percent-decode username
and password for HTTP URLs.

Signed-off-by: Gabriel Corona <gabriel.corona@enst-bretagne.fr>
Acked-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot5550: test HTTP authentication and userinfo decoding
Gabriel Corona [Sun, 14 Nov 2010 01:51:14 +0000 (02:51 +0100)]
t5550: test HTTP authentication and userinfo decoding

Add a test for HTTP authentication and proper percent-decoding of the
userinfo (username and password) part of the URL.

Signed-off-by: Gabriel Corona <gabriel.corona@enst-bretagne.fr>
Acked-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit instaweb: enable remote_heads
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:18 +0000 (13:26 +0100)]
git instaweb: enable remote_heads

When using git instaweb to browse a local repository, performance is
much less of an issue, and providing as much information as possible has
a higher priority, so it makes sense to enable remote_heads.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: group remote heads by remote
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:17 +0000 (13:26 +0100)]
gitweb: group remote heads by remote

In remote and summary view, display a block for each remote, with the
fetch and push URL(s) as well as the list of the remote heads.

In summary view, if the number of remotes is higher than a prescribed
limit, only display the first <limit> remotes and their fetch and push
urls, without any heads information and without grouping.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: provide a routine to display (sub)sections
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:16 +0000 (13:26 +0100)]
gitweb: provide a routine to display (sub)sections

The routine puts the given contento into a DIV element, automatically
adding a header div. The content can be provided as a standard scalar
value (which is used as-is), as a scalar ref (which is HTML-escaped), as
a function reference to be executed, or as a file handle to be dumped.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: refactor repository URL printing
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:15 +0000 (13:26 +0100)]
gitweb: refactor repository URL printing

Factor out the code to display the repository URL(s) from summary view
into a format_rep_url() routine.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: remotes view for a single remote
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:14 +0000 (13:26 +0100)]
gitweb: remotes view for a single remote

When 'remotes' view is passed the 'hash' parameter, interpret it as the
name of a remote and limit the view the the heads of that remote.

In single-remote view we let the user switch easily to the default
remotes view by specifying an -action_extra for the page header and by
enabling the 'remotes' link in the reference navigation submenu.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: allow action specialization in page header
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:13 +0000 (13:26 +0100)]
gitweb: allow action specialization in page header

An optional -action_extra parameter is given to git_header_html() to
identify a variant of the action that is being displayed. For example,
this can be used to specify that the remotes view is being used for a
specific remote and not to display all remotes.

When -action_extra is provided, the action name in the header will be
turned into a link to the action without any arguments or parameters, to
provide a quick link to the non-specific variant of the action.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: nagivation menu for tags, heads and remotes
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:12 +0000 (13:26 +0100)]
gitweb: nagivation menu for tags, heads and remotes

tags, heads and remotes are all views that inspect a (particular class
of) refs, so allow the user to easily switch between them by adding
the appropriate navigation submenu to each view.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: separate heads and remotes lists
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:11 +0000 (13:26 +0100)]
gitweb: separate heads and remotes lists

We specialize the 'heads' action to only display local branches, and
introduce a 'remotes' action to display the remote branches (only
available when the remotes_head feature is enabled).

Mirroring this, we also split the heads list in summary view into
local and remote lists, each linking to the appropriate action.

The git_get_heads_list now defaults to 'heads' only, regardless of
whether the remote heads feature is active or not.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: git_get_heads_list accepts an optional list of refs
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:10 +0000 (13:26 +0100)]
gitweb: git_get_heads_list accepts an optional list of refs

git_get_heads_list(limit, class1, class2, ...) can now be used to retrieve
refs/class1, refs/class2 etc. Defaults to ('heads', 'remotes') or ('heads')
depending on whether the 'remote_heads' feature is enabled or not.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: introduce remote_heads feature
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:09 +0000 (13:26 +0100)]
gitweb: introduce remote_heads feature

With this feature enabled, remote heads are retrieved (and displayed)
when getting (and displaying) the heads list. Typical usage would be for
local repository browsing, e.g. by using git-instaweb (or even a more
permanent gitweb setup), to check the repository status and the relation
between tracking branches and the originating remotes.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: use fullname as hash_base in heads link
Giuseppe Bilotta [Thu, 11 Nov 2010 12:26:08 +0000 (13:26 +0100)]
gitweb: use fullname as hash_base in heads link

Otherwise, if names are manipulated for display, the link will point to
the wrong head.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoclean: avoid quoting twice
Nguyễn Thái Ngọc Duy [Mon, 15 Nov 2010 10:12:44 +0000 (17:12 +0700)]
clean: avoid quoting twice

qname is the result of quote_path_relative(), which does
quote_c_style_counted() internally. Remove the hard-coded quotes.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodocument sigchain api
Jeff King [Fri, 12 Nov 2010 04:24:56 +0000 (23:24 -0500)]
document sigchain api

It's pretty straightforward, but a stripped-down example
never hurts. And we should make clear that it is explicitly
OK to use SIG_DFL and SIG_IGN.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoKeep together options controlling the behaviour of diffcore-rename.
Yann Dirson [Wed, 10 Nov 2010 20:27:13 +0000 (21:27 +0100)]
Keep together options controlling the behaviour of diffcore-rename.

It makes little sense to have --diff-filter in the middle of them, and
even spares an ifndef::git-format-patch.

Signed-off-by: Yann Dirson <ydirson@altern.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agouse persistent memory for rejected paths
Clemens Buchacher [Mon, 15 Nov 2010 19:52:19 +0000 (20:52 +0100)]
use persistent memory for rejected paths

An aborted merge prints the list of rejected paths as part of the
error message. Since commit f66caaf9 (do not overwrite files in
leading path), some of those paths do not have static buffers, so
we have to keep a copy. Use string_list's to accomplish this.

This changes the order of the list to the order in which the paths
are processed. Previously, it was reversed.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Mon, 15 Nov 2010 19:00:24 +0000 (11:00 -0800)]
Merge branch 'maint'

* maint:
  rebase -X: do not clobber strategy

13 years agoverify-tag: document --verbose
René Scharfe [Mon, 8 Nov 2010 18:04:51 +0000 (19:04 +0100)]
verify-tag: document --verbose

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agobranch: improve --verbose description
René Scharfe [Mon, 8 Nov 2010 18:03:58 +0000 (19:03 +0100)]
branch: improve --verbose description

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoarchive: improve --verbose description
René Scharfe [Mon, 8 Nov 2010 18:02:57 +0000 (19:02 +0100)]
archive: improve --verbose description

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDescribe various forms of "be quiet" using OPT__QUIET
Jonathan Nieder [Mon, 8 Nov 2010 19:54:48 +0000 (13:54 -0600)]
Describe various forms of "be quiet" using OPT__QUIET

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoadd OPT__FORCE
René Scharfe [Mon, 8 Nov 2010 18:01:54 +0000 (19:01 +0100)]
add OPT__FORCE

Add OPT__FORCE as a helper macro in the same spirit as OPT__VERBOSE
et.al. to simplify defining -f/--force options.

Signed-off-by: Rene Scharfe <rene.scharfe@lstfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoadd description parameter to OPT__QUIET
René Scharfe [Mon, 8 Nov 2010 18:06:54 +0000 (19:06 +0100)]
add description parameter to OPT__QUIET

Allows better help text to be defined than "be quiet".  Also make use
of the macro in a place that already had a different description.  No
object code changes intended.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoadd description parameter to OPT__DRY_RUN
René Scharfe [Mon, 8 Nov 2010 17:58:51 +0000 (18:58 +0100)]
add description parameter to OPT__DRY_RUN

Allows better help text to be defined than "dry run".  Also make use
of the macro in places that already had a different description.  No
object code changes intended.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoadd description parameter to OPT__VERBOSE
René Scharfe [Mon, 8 Nov 2010 17:56:39 +0000 (18:56 +0100)]
add description parameter to OPT__VERBOSE

Allows better help text to be defined than "be verbose".  Also make use
of the macro in places that already had a different description.  No
object code changes intended.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodo not overwrite untracked during merge from unborn branch
Clemens Buchacher [Sun, 14 Nov 2010 22:07:49 +0000 (23:07 +0100)]
do not overwrite untracked during merge from unborn branch

In case HEAD does not point to a valid commit yet, merge is
implemented as a hard reset. This will cause untracked files to be
overwritten.

Instead, assume the empty tree for HEAD and do a regular merge. An
untracked file will cause the merge to abort and do nothing. If no
conflicting files are present, the merge will have the same effect
as a hard reset.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotests: use test_cmp instead of piping to diff(1)
Ævar Arnfjörð Bjarmason [Sun, 14 Nov 2010 14:44:16 +0000 (14:44 +0000)]
tests: use test_cmp instead of piping to diff(1)

Change submodule tests that piped to diff(1) to use test_cmp. The
resulting unified diff is easier to read.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot7004-tag.sh: re-arrange git tag comment for clarity
Ævar Arnfjörð Bjarmason [Sun, 14 Nov 2010 14:44:15 +0000 (14:44 +0000)]
t7004-tag.sh: re-arrange git tag comment for clarity

Split the "message in editor has initial comment" test into three
tests. The motivation is to be able to only skip the middle part under
NO_GETTEXT_POISON.

In addition the return value of 'git tag' was being returned. We now
check that it's non-zero. I used ! instead of test_must_fail so that
the GIT_EDITOR variable was only used in this command invocation, and
because the surrounding tests use this style.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosetup: make sure git_dir path is in a permanent buffer, getenv(3) case
Kirill Smelkov [Thu, 11 Nov 2010 18:08:23 +0000 (21:08 +0300)]
setup: make sure git_dir path is in a permanent buffer, getenv(3) case

getenv(3) returns not-permanent buffer which may be changed by e.g.
putenv(3) call (*).

In practice I've noticed this when trying to do `git commit -m abc`
inside msysgit under wine, getting

    $ git commit -m abc
    fatal: could not open 'DIR=.git/COMMIT_EDITMSG': No such file or directory
                           ^^^^
    (notice introduced 'DIR=' artifact.)

The problem was showing itself only with -m option, and actually, as
debugging showed, originally

    git_dir = getenv("GIT_DIR")

returned pointer to

        "GIT_DIR=.git\0"
                 ^
               git_dir

, we stored it in git_dir, than, after processing -m git-commit option,
we did setenv("GIT_EDITOR", ":") which as (*) says changed environment
variables memory layout - something like this

       "...\0GIT_DIR=.git\0"
                 ^
               git_dir

and oops - we got wrong git_dir.

Avoid that by strdupping getenv("GIT_DIR") result like we did in 06f354
(setup: make sure git dir path is in a permanent buffer). Unfortunately
this also shows that other getenv usage inside git needs auditing...

(*) from man 3 getenv:

       The implementation of getenv() is not required to  be  reentrant.   The
       string  pointed  to  by  the return value of getenv() may be statically
       allocated, and can be  modified  by  a  subsequent  call  to  getenv(),
       putenv(3), setenv(3), or unsetenv(3).

Cc: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogit-send-email.perl: make initial In-Reply-To apply only to first email
Antonio Ospite [Fri, 12 Nov 2010 14:55:08 +0000 (15:55 +0100)]
git-send-email.perl: make initial In-Reply-To apply only to first email

When an initial --in-reply-to is supplied, make it apply only to the
first message; --[no-]chain-reply-to setting are honored by second and
subsequent messages; this is also how the git-format-patch option with
the same name behaves.

Moreover, when $initial_reply_to is asked to the user interactively it
is asked as the "Message-ID to be used as In-Reply-To for the _first_
email", this makes the user think that the second and subsequent
patches are not using it but are considered as replies to the first
message or chained according to the --[no-]chain-reply setting.

Look at the v2 series in the illustration to see what the new behavior
ensures:

       (before the patch)          |      (after the patch)
 [PATCH 0/2] Here is what I did... | [PATCH 0/2] Here is what I did...
   [PATCH 1/2] Clean up and tests  |   [PATCH 1/2] Clean up and tests
   [PATCH 2/2] Implementation      |   [PATCH 2/2] Implementation
   [PATCH v2 0/3] Here is a reroll |   [PATCH v2 0/3] Here is a reroll
   [PATCH v2 1/3] Clean up         |     [PATCH v2 1/3] Clean up
   [PATCH v2 2/3] New tests        |     [PATCH v2 2/3] New tests
   [PATCH v2 3/3] Implementation   |     [PATCH v2 3/3] Implementation

This is the typical behaviour we want when we send a series with cover
letter in reply to some discussion, the new patch series should appear
as a separate subtree in the discussion.

Also update the documentation on --in-reply-to to describe the new
behavior.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot3402: test "rebase -s<strategy> -X<opt>"
Junio C Hamano [Thu, 11 Nov 2010 21:28:57 +0000 (13:28 -0800)]
t3402: test "rebase -s<strategy> -X<opt>"

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: point to related commands from gitignore
Jonathan Nieder [Wed, 10 Nov 2010 19:00:48 +0000 (13:00 -0600)]
Documentation: point to related commands from gitignore

A frequently asked question on #git is how to stop tracking a file
that is mistakenly tracked by git.  A frequently attempted strategy is
to add such files to .gitignore.

Thus one might imagine that the gitignore documentation could be a
good entry point for 'git rm' documentation.  Add some
cross-references in this vein.

While at it, move a reference to update-index --assume-unchanged from
the DESCRIPTION to lower down on the page.  This way, the methodical
reader can benefit from first learning what excludes files do, then
how they relate to other git facilities.

Based-on-patch-by: Sitaram Chamarty <sitaram@atc.tcs.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoDocumentation: split gitignore page into sections
Jonathan Nieder [Wed, 10 Nov 2010 18:57:39 +0000 (12:57 -0600)]
Documentation: split gitignore page into sections

A learner-by-example might want to look at the examples section first.
Help her out by supplying some section headings: PATTERN FORMAT for
the format of lines in an excludes file and EXAMPLES for the two
examples.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoRemove pack file handling dependency from wrapper.o
Jonathan Nieder [Sat, 6 Nov 2010 19:00:38 +0000 (14:00 -0500)]
Remove pack file handling dependency from wrapper.o

As v1.7.0-rc0~43 (slim down "git show-index", 2010-01-21) explains,
use of xmalloc() brings in a dependency on zlib, the sha1 lib, and the
rest of git's object file access machinery via try_to_free_pack_memory.
That is overkill when xmalloc is just being used as a convenience
wrapper to exit when no memory is available.

So defer setting try_to_free_pack_memory as try_to_free_routine until
the first packfile is opened in add_packed_git().

After this change, a simple program using xmalloc() and no other
functions will not pull in any code from libgit.a aside from wrapper.o
and usage.o.

Improved-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agopack-objects: mark file-local variable static
Jonathan Nieder [Sat, 6 Nov 2010 11:47:57 +0000 (06:47 -0500)]
pack-objects: mark file-local variable static

old_try_to_free_routine is not meant for use from other files.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agowrapper: give zlib wrappers their own translation unit
Jonathan Nieder [Sat, 6 Nov 2010 11:47:34 +0000 (06:47 -0500)]
wrapper: give zlib wrappers their own translation unit

Programs using xmalloc() but not git_inflate() require -lz on the
linker command line because git_inflate() is in the same translation
unit as xmalloc().

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agostrbuf: move strbuf_branchname to sha1_name.c
Jonathan Nieder [Sat, 6 Nov 2010 11:46:52 +0000 (06:46 -0500)]
strbuf: move strbuf_branchname to sha1_name.c

strbuf_branchname is a thin wrapper around interpret_branch_name
from sha1_name.o.  Most strbuf.o users do not need it.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agopath helpers: move git_mkstemp* to wrapper.c
Jonathan Nieder [Sat, 6 Nov 2010 11:46:31 +0000 (06:46 -0500)]
path helpers: move git_mkstemp* to wrapper.c

git_mkstemp_mode and related functions do not require access to
specialized git machinery, unlike some other functions from
path.c (like set_shared_perm()).  Move them to wrapper.c where
the wrapper xmkstemp_mode is defined.

This eliminates a dependency of wrapper.o on environment.o via
path.o.  With typical linkers (e.g., gcc), that dependency makes
programs that use functions from wrapper.o and not environment.o
or path.o larger than they need to be.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agowrapper: move odb_* to environment.c
Jonathan Nieder [Sat, 6 Nov 2010 11:45:38 +0000 (06:45 -0500)]
wrapper: move odb_* to environment.c

The odb_mkstemp and odb_pack_keep functions open files under the
$GIT_OBJECT_DIRECTORY directory.  This requires access to the git
configuration which very simple programs do not need.

Move these functions to environment.o, closer to their dependencies.
This should make it easier for programs to link to wrapper.o without
linking to environment.o.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agowrapper: move xmmap() to sha1_file.c
Jonathan Nieder [Sat, 6 Nov 2010 11:44:11 +0000 (06:44 -0500)]
wrapper: move xmmap() to sha1_file.c

wrapper.o depends on sha1_file.o for a number of reasons.  One is
release_pack_memory().

xmmap function calls mmap, discarding unused pack windows when
necessary to relieve memory pressure.  Simple git programs using
wrapper.o as a friendly libc do not need this functionality.
So move xmmap to sha1_file.o, where release_pack_memory() is.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agonotes.h/c: Allow combine_notes functions to remove notes
Johan Herland [Tue, 9 Nov 2010 21:49:41 +0000 (22:49 +0100)]
notes.h/c: Allow combine_notes functions to remove notes

Allow combine_notes functions to request that a note be removed, by setting
the resulting note SHA1 to null_sha1 (0000000...).

For consistency, also teach note_tree_insert() to skip insertion of an empty
note (a note with entry->val_sha1 equal to null_sha1) when there is no note
to combine it with.

In general, an empty note (null_sha1) is treated identically to no note at
all, but when adding an empty note where there already exists a non-empty
note, we allow the combine_notes function to potentially record a new/changed
note. Document this behaviour, and clearly specify how combine_notes functions
are expected to handle null_sha1 in input.

Before this patch, storing null_sha1s in the notes tree were silently allowed,
causing an invalid notes tree (referring to blobs with null_sha1) to be
produced by write_notes_tree().

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agonotes.c: Reorder functions in preparation for next commit
Johan Herland [Tue, 9 Nov 2010 21:49:40 +0000 (22:49 +0100)]
notes.c: Reorder functions in preparation for next commit

This patch introduces no functional change. It consists solely of reordering
functions in notes.c to avoid use-before-declaration errors after applying
the next commit in this series.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agonotes.h: Make default_notes_ref() available in notes API
Johan Herland [Tue, 9 Nov 2010 21:49:39 +0000 (22:49 +0100)]
notes.h: Make default_notes_ref() available in notes API

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years ago(trivial) notes.h: Minor documentation fixes to copy_notes()
Johan Herland [Tue, 9 Nov 2010 21:49:38 +0000 (22:49 +0100)]
(trivial) notes.h: Minor documentation fixes to copy_notes()

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agonotes.c: Hexify SHA1 in die() message from init_notes()
Johan Herland [Tue, 9 Nov 2010 21:49:37 +0000 (22:49 +0100)]
notes.c: Hexify SHA1 in die() message from init_notes()

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotag: recognize rfc1991 signatures
Michael J Gruber [Wed, 10 Nov 2010 11:17:30 +0000 (12:17 +0100)]
tag: recognize rfc1991 signatures

We have always been creating rfc1991 signatures for users with "rfc1991"
in their gpg config but failed to recognize them (tag -l -n largenumber)
and verify them (tag -v, verify-tag).

Make good use of the refactored signature detection and let us recognize
and verify those signatures also.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotag: factor out sig detection for tag display
Michael J Gruber [Wed, 10 Nov 2010 11:17:29 +0000 (12:17 +0100)]
tag: factor out sig detection for tag display

Use the factored out code for sig detection when displaying tags.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotag: factor out sig detection for body edits
Michael J Gruber [Wed, 10 Nov 2010 11:17:28 +0000 (12:17 +0100)]
tag: factor out sig detection for body edits

Use the factored out code for sig detection when editing existing
tag bodies (tag -a -f without -m).

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoverify-tag: factor out signature detection
Michael J Gruber [Wed, 10 Nov 2010 11:17:27 +0000 (12:17 +0100)]
verify-tag: factor out signature detection

into tag.h/c for later reuse and modification.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot/t7004-tag: test handling of rfc1991 signatures
Michael J Gruber [Wed, 10 Nov 2010 11:17:26 +0000 (12:17 +0100)]
t/t7004-tag: test handling of rfc1991 signatures

Currently, git expects "-----BEGIN PGP SIGNATURE-----" at the beginning of a
signature. But gpg uses "MESSAGE" instead of "SIGNATURE" when used with
the "rfc1991" option. This leads to git's failing to verify it's own
signed tags, among other problems.

Add tests for all code paths (tag -v, tag -l -n largenumber, tag -f
without -m) where signature detection matters.

Reported-by: Stephan Hugel <urschrei@gmail.com>
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agorebase -X: do not clobber strategy
Martin von Zweigbergk [Wed, 10 Nov 2010 07:14:26 +0000 (08:14 +0100)]
rebase -X: do not clobber strategy

If any strategy options are passed to -X, the strategy will always be
set to 'recursive'. According to the documentation, it should default to
'recursive' if it is not set, but it should be possible to set it to
other values.

This fixes a regression introduced in v1.7.3-rc0~67^2 (2010-07-29).

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocherry-pick/revert: transparently refresh index
Jonathan Nieder [Sun, 31 Oct 2010 19:59:33 +0000 (14:59 -0500)]
cherry-pick/revert: transparently refresh index

A stat-dirty index is not a detail that ought to concern the operator
of porcelain such as "git cherry-pick".

Without this change, a cherry-pick after copying a worktree with rsync
errors out with a misleading message.

$ git cherry-pick build/top
error: Your local changes to 'file.h' would be overwritten by merge.  Aborting.
Please, commit your changes or stash them before you can merge.

Noticed-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoapply: handle patches with funny filename and colon in timezone
Jonathan Nieder [Wed, 29 Sep 2010 21:41:08 +0000 (16:41 -0500)]
apply: handle patches with funny filename and colon in timezone

Some patches have a timezone formatted like '-08:00' instead of
'-0800' in their ---/+++ lines (e.g. http://lwn.net/Articles/131729/).
Take this into account when searching for the start of the timezone
(which is the end of the filename).

This does not actually affect the outcome of patching unless (1) a
file being patched has a non-' ' whitespace character (e.g., tab) in
its filename, or (2) the patch is whitespace-damaged, so the tab
between filename and timestamp has been replaced with spaces.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agodocs: give more hints about how "add -e" works
Jeff King [Tue, 9 Nov 2010 04:58:20 +0000 (23:58 -0500)]
docs: give more hints about how "add -e" works

The previous text was not exactly accurate; it is OK to
change space and minus lines, but only in certain ways.

This patch takes a whole new approach, which is to describe
the sorts of conceptual operations you might want to
perform. It also includes a healthy dose of warnings about
how things can go wrong.

Since the size of the text is getting quite long, it also
splits this out into an "editing patches" section. This
makes more sense with the current structure, anyway, which
already splits out the interactive mode description.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot4124 (apply --whitespace): use test_might_fail
Jonathan Nieder [Sun, 31 Oct 2010 07:41:08 +0000 (02:41 -0500)]
t4124 (apply --whitespace): use test_might_fail

Use test_might_fail instead of ignoring the exit status from git
config --unset, and let the exit status propagate past rm -f (which
does not fail on ENOENT).  Otherwise bugs that lead git config to
crash would not be detected when this test runs.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot3404: do not use 'describe' to implement test_cmp_rev
Junio C Hamano [Tue, 9 Nov 2010 23:20:20 +0000 (15:20 -0800)]
t3404: do not use 'describe' to implement test_cmp_rev

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot3404 (rebase -i): introduce helper to check position of HEAD
Jonathan Nieder [Sun, 31 Oct 2010 07:40:30 +0000 (02:40 -0500)]
t3404 (rebase -i): introduce helper to check position of HEAD

The same code to check the position of HEAD is used by several
tests in this script.  Factor it out as a function and simplify it.

Noticed using an &&-chaining tester, because the current code
does not propagate the precise exit status from errors.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot3404 (rebase -i): move comment to description
Jonathan Nieder [Sun, 31 Oct 2010 07:39:51 +0000 (02:39 -0500)]
t3404 (rebase -i): move comment to description

Add a comment describing the setup in t3404 to its --help output.

This should make it easier to decide where to put new functions
without disrupting the flow of the file or obstructing the description
of the test setup.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot3404 (rebase -i): unroll test_commit loops
Jonathan Nieder [Sun, 31 Oct 2010 07:38:25 +0000 (02:38 -0500)]
t3404 (rebase -i): unroll test_commit loops

Allow test_commit failures in loop iterations before the last one to
cause the test assertion to fail.

More importantly, avoiding these loops makes the test a little
simpler to read and decreases the vertical screen footprint of
the setup test assertion by one line.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot3301 (notes): use test_expect_code for clarity
Jonathan Nieder [Sun, 31 Oct 2010 07:36:57 +0000 (02:36 -0500)]
t3301 (notes): use test_expect_code for clarity

Use the test_expect_code helper instead of open-coding it.

The main behavior change is to print the command and actual exit
status when the test fails.  More importantly, this would make it
easier to add commands before "git notes show" as part of the
same test assertion if needed.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>