Commit Graph

15387 Commits

Author SHA1 Message Date
Junio C Hamano
6536034630 Merge branch 'maint' into ph/checkout
* maint:
  git-checkout: fix command line parsing.
2008-07-23 18:42:24 -07:00
Stephan Beyer
186458b11b Make non-static functions, that may be static, static
Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 18:38:14 -07:00
Junio C Hamano
0c4cd7f4a7 ignore non-existent refs in dwim_log()
f2eba66 (Enable HEAD@{...} and make it independent from the current
branch, 2007-02-03) introduced dwim_log() to handle <refname>@{...}
syntax, and as part of its processing, it checks if the ref exists by
calling refsolve_ref().  It should call it as a reader to make sure the
call returns NULL for a nonexistent ref (not as a potential writer in
which case it does not return NULL).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 18:11:04 -07:00
Thomas Rast
2ca880fe54 git-completion.bash: provide completion for 'show-branch'
It previously used the same as 'log', but the options are quite
different and the arguments must be single refs (or globs).

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 17:06:36 -07:00
Lee Marlow
08c701d476 bash completion: Add long options for 'git rm'
Options added: --cached --dry-run --ignore-unmatch --quiet

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 17:06:30 -07:00
P. Christeas
e8a43a132d svnimport: newer libsvn wants us to ask for the root with "", not "/"
In r27729, libsvn introduced an assert which explicitly
forbids searching the tree at "/". Luckily enough, it
still accepts an empty string "" as the starting point.

http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_ra/ra_loader.c?r1=27653&r2=27729

Tested against libsvn0-1.5.0-4mdv2009.0 (needs the fix),
libsvn0-1.4.6-5mdv2008.1 (works anyway)

Signed-off-by: P. Christeas <p_christ@hol.gr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 16:58:09 -07:00
Petr Baudis
eb72a51407 Documentation/git-filter-branch: teach "rm" instead of "update-index --remove"
The example to remove paths using index-filter was done with
"git update-index --remove"; "git rm --cached" would be more familiar to
new people and is sufficient for this particular case.

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 16:57:14 -07:00
Johannes Schindelin
f9bbefc701 git daemon: avoid waking up too often
To avoid waking up unnecessarily, a pipe is set up that is only ever
written to by child_handler(), when a child disconnects, as suggested
per Junio.

This avoids waking up the main process every second to see if a child
was disconnected.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 16:57:14 -07:00
Johannes Schindelin
3b6aeb3cc3 builtin-commit: Two trivial style-cleanups
Pierre Habouzit noticed that two variables were not static which should
have been, and that adding "\n\n" is better than adding '\n' twice.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 16:57:14 -07:00
Junio C Hamano
ea3d988df7 Documentation: clarify diff --cc
The definition of an "uninteresting" hunk was not in line with reality.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 16:57:13 -07:00
Stephan Beyer
a31c00b00e am --abort: Add to bash-completion and mention in git-rerere documentation
The git-rerere documentation talks about commands that invoke
"git rerere clear" automatically. git am --abort is added and
a typo is fixed additionally.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 16:57:09 -07:00
Petr Baudis
a4661b018d git-filter-branch.sh: Allow running in bare repositories
Commit 46eb449c restricted git-filter-branch to non-bare repositories
unnecessarily; git-filter-branch can work on bare repositories just
fine.

Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 16:57:04 -07:00
Junio C Hamano
68067ca1ef builtin-branch.c: optimize --merged and --no-merged
"git branch --no-merged $commit" used to compute the merge base between
the tip of each and every branch with the named $commit, but this was
wasteful when you have many branches.  Inside append_ref() we literally
ran has_commit() between the tip of the branch and the merge_filter_ref.

Instead, we can let the revision machinery traverse the history as if we
are running:

    $ git rev-list --branches --not $commit

by queueing the tips of branches we encounter as positive refs (this
mimicks the "--branches" option in the above command line) and then
appending the merge_filter_ref commit as a negative one, and finally
calling prepare_revision_walk() to limit the list..

After the traversal is done, branch tips that are reachable from $commit
are painted UNINTERESTING; they are already fully contained in $commit
(i.e. --merged).  Tips that are not painted UNINTERESTING still have
commits that are not reachable from $commit, thus "--no-merged" will show
them.

With an artificial repository that has "master" and 1000 test-$i branches
where they were created by "git branch test-$i master~$i":

    (with patch)
    $ /usr/bin/time git-branch --no-merged master >/dev/null
    0.12user 0.02system 0:00.15elapsed 99%CPU (0avgtext+0avgdata 0maxresident)k
    0inputs+0outputs (0major+1588minor)pagefaults 0swaps

    $ /usr/bin/time git-branch --no-merged test-200 >/dev/null
    0.15user 0.03system 0:00.18elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
    0inputs+0outputs (0major+1711minor)pagefaults 0swaps

    (without patch)
    $ /usr/bin/time git-branch --no-merged master >/dev/null
    0.69user 0.03system 0:00.72elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
    0inputs+0outputs (0major+2229minor)pagefaults 0swaps

    $ /usr/bin/time git-branch --no-merged test-200 >/dev/null
    0.58user 0.03system 0:00.61elapsed 100%CPU (0avgtext+0avgdata 0maxresident)k
    0inputs+0outputs (0major+2248minor)pagefaults 0swaps

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 16:57:04 -07:00
Junio C Hamano
0f31d68030 builtin-branch.c: remove unused code in append_ref() callback function
We let for_each_ref() to feed all refs to append_ref() but we are only
ever interested in local or remote tracking branches.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 16:57:03 -07:00
Junio C Hamano
47629dcff0 stash save: fix parameter handling
A command line "git stash save --keep-index I was doing this" was
misparsed and keep-index codepath did not trigger.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 16:57:03 -07:00
Stephan Beyer
c8fe1980b2 git-am: Add colon before the subject that is printed out as being applied
git-am output can be confusing, because the subject of the applied
patch can look like the rest of a sentence starting with "Applying".
The added colon should make this clearer.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 12:31:37 -07:00
Pierre Habouzit
f5242ebf0d git-checkout: fix command line parsing.
This fixes an issue when you use:

    $ git checkout -- <path1> [<paths>...]

and that <path1> can also be understood as a reference. git-checkout
mistakenly understands this as the same as:

    $ git checkout <path1> -- [<paths>...]

because parse-options was eating the '--' and the argument parser thought
he was parsing:

    $ git checkout <path1> [<paths>...]

Where there indeed is an ambiguity

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 12:09:47 -07:00
Johannes Sixt
a8ccc204c5 rebase -i: When an 'edit' stops, mention the commit
In a rebase session where more than one commit is to be 'edit'ed, and the
user spends considerable time to 'edit' a commit, it is easy to forget what
one wanted to 'edit' at the individual commits. It would be helpful to see
at which commit the rebase stopped.

Incidentally, if the rebase stopped due to merge conflicts or other errors,
the commit was already reported ("Could not apply $sha1..."), but when
rebase stopped after successfully applying an "edit" commit, it would not
mention it. With this change the commit is reported.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 12:02:57 -07:00
Johannes Schindelin
e358f3c31e sort_in_topological_order(): avoid setting a commit flag
We used to set the TOPOSORT flag of commits during the topological
sorting, but we can just as well use the member "indegree" for it:
indegree is now incremented by 1 in the cases where the commit used
to have the TOPOSORT flag.

This is the same behavior as before, since indegree could not be
non-zero when TOPOSORT was unset.

Incidentally, this fixes the bug in show-branch where the 8th column
was not shown: show-branch sorts the commits in topological order,
assuming that all the commit flags are available for show-branch's
private matters.

But this was not true: TOPOSORT was identical to the flag corresponding
to the 8th ref.  So the flags for the 8th column were unset by the
topological sorting.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 12:00:21 -07:00
Johannes Schindelin
ce567d1867 Add test to show that show-branch misses out the 8th column
Noticed by Pasky.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 11:52:21 -07:00
Johannes Schindelin
7d90c8ee15 Ignore dirty submodule states in "git pull --rebase"
This is a companion patch to 6848d58c(Ignore dirty submodule states
during rebase and stash).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 11:36:56 -07:00
Brandon Casey
c65233fe2c t/t4202-log.sh: add newline at end of file
Some shells hang when parsing the script if the last statement is not
followed by a newline. So add one.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 11:36:41 -07:00
Brandon Casey
09b78bc1fc t7502-commit.sh: rearrange test to make more portable
Some shells have problems with one-shot environment variable export
and function calls. The sequence is rearranged to avoid the one-shot
and to allow the test script to be linked together with '&&'.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 11:36:31 -07:00
Brandon Casey
03b9dfb18b t3200,t7201: replace '!' with test_must_fail
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 11:35:23 -07:00
Brandon Casey
9a885fac0d t4116-apply-reverse.sh: use $TAR rather than tar
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 11:35:16 -07:00
Brandon Casey
2b14d07237 t/: Replace diff [-u|-U0] with test_cmp to allow compilation with old diff
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 11:35:01 -07:00
Miklos Vajna
4d175ef71d t7601: extend the 'merge picks up the best result' test
The test only checked if the best result picking code works if there are
multiple strategies set in the config. Add a similar one that tests if
the same true if the -s option of git merge was used multiple times.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 11:33:40 -07:00
Daniel Barkalow
2d71bde2d1 In perforce, RCS keywords are case-sensitive
At least, this is true in 2007.2, according to the documentation.

Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 11:33:34 -07:00
Alex Riesen
8f0359f0a6 Allow pager of diff command be enabled/disabled
See for example, status and show commands. Besides,
Documentation/RelNotes-1.6.0.txt mentions that pager.<cmd>
can be used to enable/disable paging behavior per command.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-23 11:14:47 -07:00
Johannes Schindelin
0dda1d1ec8 Fix two leftovers from path_list->string_list
In the documentation, where you cannot get compile errors for using the
wrong member name, there were two mentions of 'path' left.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-22 15:28:22 -07:00
Olivier Marin
95f8ebbfc7 git am --skip: clean the index while preserving local changes
In 3-way merge, "am" will let the index with unmerged path waiting
for us to resolve conflicts and continue. But if we want to --skip
instead, "am" refuses to continue because of the dirty index.

With this patch, "am" will clean the index without touching files
locally modified, before continuing.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-22 00:06:04 -07:00
Pierre Habouzit
d1f63a37ca git-submodule: move ill placed shift.
When running git submodule update -i, the "-i" is shifted before recursing
into cmd_init and then again outside of the loop. This causes some /bin/sh
to complain about shifting when there are no arguments left (and would
discard anything written after -i too).

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-21 22:36:29 -07:00
Pierre Habouzit
5d2299de2d builtin-merge: add missing structure initialization
The parameter that is eventually passed to read_directory() to scan the
working tree should be properly initialized.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-21 22:32:53 -07:00
Miklos Vajna
1719b5e446 builtin-merge: give a proper error message for invalid strategies in config
'git merge -s foobar' diagnosed invalid "foobar" strategy and errored out
with a message, but foobar in pull.twohead or pull.octopus was just
silently ignored.  This makes invalid strategy both on the command line
and in the configuration file to trigger the same error.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-21 22:29:46 -07:00
Junio C Hamano
ac2e28c0a4 tests: do not rely on external "patch"
Some of our tests assumed a working "patch" command to produce expected
results when checking "git-apply", but some systems have broken "patch".

We can compare our output with expected output that is precomputed
instead to sidestep this issue.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-21 21:33:16 -07:00
Nikolaj Schumacher
c79cc2e596 Don't cut off last character of commit descriptions.
This should have been part of 24a2293 (git-blame.el: show the when, who
and what in the minibuffer., 2008-02-12), that changed from using
--pretty=oneline to --pretty=format:... without terminating newline.

Acked-by: David Kågedal <davidk@lysator.liu.se>

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-21 21:21:51 -07:00
Olivier Marin
d5d745f90b parse-options: fix segmentation fault when a required value is missing
p->argc represent the number of arguments that have not been parsed yet,
_including_ the one we are currently parsing. If it is not greater than
one then there is no more argument.

Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Acked-by: Pierre Habouzit <madcoder@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-21 21:20:04 -07:00
Philippe Bruhat (BooK)
0d4ede9f54 mailinfo: better parse email adresses containg parentheses
When using git-rebase, author fields containing a ')' at the last position
had the close-parens character removed; the removal should be done only
when it is of this form:

        user@host (User Name)

i.e. the remainder after stripping the e-mail address part is enclosed in
a parentheses pair as a whole, not for addresses like this:

        User Name (me) <user@host>

Signed-off-by: Philippe Bruhat (BooK) <book@cpan.org>
Acked-by: Lukas Sandström <lukass@etek.chalmers.se>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-21 20:09:12 -07:00
Olivier Marin
75e1645fbe git-am: remove dash from help message
Signed-off-by: Olivier Marin <dkr@freesurf.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-21 19:56:56 -07:00
Junio C Hamano
107623239a Revert "make git-status use a pager"
This reverts commit c8af1de9cf.

The change was immensely unpopular, and poeple who would really want to
page can use pager.status configuration.
2008-07-21 19:41:17 -07:00
Jonathan Nieder
e57c817d9f git-diff(1): "--c" -> "--cc" typo fix
git diff does not take a --c option.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-21 19:17:23 -07:00
Johannes Schindelin
c455c87c5c Rename path_list to string_list
The name path_list was correct for the first usage of that data structure,
but it really is a general-purpose string list.

$ perl -i -pe 's/path-list/string-list/g' $(git grep -l path-list)
$ perl -i -pe 's/path_list/string_list/g' $(git grep -l path_list)
$ git mv path-list.h string-list.h
$ git mv path-list.c string-list.c
$ perl -i -pe 's/has_path/has_string/g' $(git grep -l has_path)
$ perl -i -pe 's/path/string/g' string-list.[ch]
$ git mv Documentation/technical/api-path-list.txt \
	Documentation/technical/api-string-list.txt
$ perl -i -pe 's/strdup_paths/strdup_strings/g' $(git grep -l strdup_paths)

... and then fix all users of string-list to access the member "string"
instead of "path".

Documentation/technical/api-string-list.txt needed some rewrapping, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-21 19:11:50 -07:00
Johannes Schindelin
51ef1daa4a Rename .git/rebase to .git/rebase-apply
With git-am, it sounds awkward to have the patches in ".git/rebase/",
but for technical reasons, we have to keep the same directory name
for git-am and git-rebase. ".git/rebase-apply" seems to be a good
compromise.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-21 18:51:47 -07:00
Junio C Hamano
59eb68aa2b Update my e-mail address
The old cox.net address is still getting mails from gitters.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-21 12:14:42 -07:00
Junio C Hamano
93310a40eb Merge branch 'ap/trackinfo'
* ap/trackinfo:
  Reword "your branch has diverged..." lines to reduce line length
2008-07-20 18:00:27 -07:00
Junio C Hamano
d1f2e1696c Merge branch 'jc/rerere-auto-more'
* jc/rerere-auto-more:
  rerere.autoupdate: change the message when autoupdate is in effect
2008-07-20 18:00:17 -07:00
Junio C Hamano
245648dede Merge branch 'ns/am-abort'
* ns/am-abort:
  git am --abort
2008-07-20 18:00:13 -07:00
Junio C Hamano
378335b37c Merge branch 'jc/add-addremove'
* jc/add-addremove:
  git-add --all: documentation
  git-add --all: tests
  git-add --all: add all files
  builtin-add.c: restructure the code for maintainability

Conflicts:
	builtin-add.c
2008-07-20 17:53:17 -07:00
Junio C Hamano
d14e7407b3 "needs update" considered harmful
"git update-index --refresh", "git reset" and "git add --refresh" have
reported paths that have local modifications as "needs update" since the
beginning of git.

Although this is logically correct in that you need to update the index at
that path before you can commit that change, it is now becoming more and
more clear, especially with the continuous push for user friendliness
since 1.5.0 series, that the message is suboptimal.  After all, the change
may be something the user might want to get rid of, and "updating" would
be absolutely a wrong thing to do if that is the case.

I prepared two alternatives to solve this.  Both aim to reword the message
to more neutral "locally modified".

This patch is a more intrusive variant that changes the message for only
Porcelain commands ("add" and "reset") while keeping the plumbing
"update-index" intact.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-20 17:21:32 -07:00
Junio C Hamano
559e840b74 Move read_in_full() and write_in_full() to wrapper.c
A few compat/* layer functions call these functions, but we would really
want to keep them thin, without depending too much on the libgit proper.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-20 17:17:09 -07:00