Commit graph

15668 commits

Author SHA1 Message Date
Miklos Vajna 26463c8f7c Fix 'git help help'
git help foo invokes man git-foo if foo is a git command, otherwise it
invokes man gitfoo. 'help' is not a git command, but the manual page is
called git-help, so add this special exception.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Acked-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-21 22:18:21 -07:00
Brandon Casey a81892dd8c compat/snprintf.c: handle snprintf's that always return the # chars transmitted
Some platforms provide a horribly broken snprintf. More broken than the
platforms that return -1 when there is too little space in the target buffer
for the formatted string. Some platforms provide an snprintf which _always_
returns the number of characters transmitted to the buffer, regardless of
whether there was enough space or not.

IRIX 6.5 is such a platform. IRIX does have a working snprintf(), but it
is only provided when _NO_XOPEN5 evaluates to zero, and this only happens
if _XOPEN_SOURCE is defined, but definition of _XOPEN_SOURCE prevents
inclusion of many other common functions and defines. So it must be avoided.

Work around these horribly broken snprintf implementations by detecting an
snprintf call which results in the number of transmitted characters exactly
equal to the length of our buffer and retrying with a larger buffer just to
be safe.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Acked-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-21 01:53:44 -07:00
Eric Wong 711521e246 git-svn: fix dcommit to urls with embedded usernames
Don't rely on the extracted URL from working_head_info since that has the
username removed.  Instead use the $gs->full_url method (as before with
ba24e74 (git-svn: add ability to specify --commit-url for dcommit,
2008-08-07)) to give us the URL to commit to if --commit-url is not
specified.

Aditionally, since we clean usernames from URLs, checking the URL after
rebase can fail because it doesn't match the URL we used to commit; so
unconditionally provide a username-free URL for checking the result of the
refetch.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-20 23:48:07 -07:00
Brandon Casey 4dc1db0bd1 revision.h: make show_early_output an extern which is defined in revision.c
The variable show_early_output is defined in revision.c and should be
declared extern in revision.h so that the linker does not complain
about multiply defined variables.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-20 19:59:06 -07:00
Junio C Hamano 9b99e641c1 Update draft release notes for 1.6.0.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-20 16:05:01 -07:00
Tarmigan Casebolt 3a634dcf51 Add hints to revert documentation about other ways to undo changes
Based on its name, people may read the 'git revert' documentation when
they want to undo local changes, especially people who have used other
SCM's.  'git revert' may not be what they had in mind, but git
provides several other ways to undo changes to files.  We can help
them by pointing them towards the git commands that do what they might
want to do.

Cc: Daniel Barkalow <barkalow@iabervon.org>
Cc: Lea Wiemann <lewiemann@gmail.com>
Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-20 16:04:45 -07:00
Johannes Sixt 71f463773a Install templates with the user and group of the installing personality
If 'make install' was run with sufficient privileges, then the installed
templates, which are copied using 'tar', would receive the user and group
of whoever built git. This instructs 'tar' to ignore the user and group
that are recorded in the archive.

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-20 16:01:45 -07:00
Junio C Hamano 9ca8f6079c "git-merge": allow fast-forwarding in a stat-dirty tree
We used to refresh the index to clear stat-dirtyness before a fast-forward
merge.  Recent C rewrite forgot to do this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-20 15:49:21 -07:00
Junio C Hamano 25b3d4d6f3 completion: find out supported merge strategies correctly
"git-merge" is a binary executable these days, and looking for assignment
to $all_strategies variable with grep/sed does not work well.

When asked for an unknown strategy, pre-1.6.0 and post-1.6.0 "git merge"
commands respectively say:

    $ $HOME/git-snap-v1.5.6.5/bin/git merge -s help
    available strategies are: recur recursive octopus resolve stupid ours subtree
    $ $HOME/git-snap-v1.6.0/bin/git merge -s help
    Could not find merge strategy 'help'.
    Available strategies are: recursive octopus resolve ours subtree.

both on their standard error stream.  We can use this to learn what
strategies are supported.

The sed script is written in such a way that it catches both old and new
message styles ("Available" vs "available", and the full stop at the end).
It also allows future versions of "git merge" to line-wrap the list of
strategies, and add extra comments, like this:

    $ $HOME/git-snap-v1.6.1/bin/git merge -s help
    Could not find merge strategy 'help'.
    Available strategies are: blame recursive octopus resolve ours
    subtree.
    Also you have custom strategies: theirs

    Make sure you spell strategy names correctly.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-20 15:48:52 -07:00
Jeff King 54988bdad7 decorate: allow const objects to be decorated
We don't actually modify the struct object, so there is no
reason not to accept const versions (and this allows other
callsites, like the next patch, to use the decoration
machinery).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-20 13:30:49 -07:00
Junio C Hamano e276c26b4b for-each-ref: cope with tags with incomplete lines
If you have a tag with a single, incomplete line as its payload, asking
git-for-each-ref for its %(body) element accessed a NULL pointer.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-20 13:29:30 -07:00
Junio C Hamano c35539eb10 diff --check: do not get confused by new blank lines in the middle
The code remembered that the last diff output it saw was an empty line,
and tried to reset that state whenever it sees a context line, a non-blank
new line, or a new hunk.  However, this codepath asks the underlying diff
engine to feed diff without any context, and the "just saw an empty line"
state was not reset if you added a new blank line in the last hunk of your
patch, even if it is not the last line of the file.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-20 13:28:19 -07:00
Jim Meyering c71e917975 remote.c: remove useless if-before-free test
We removed a handful of these useless if-before-free tests several months
ago.  This change removes a new one that snuck back in.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-19 21:09:30 -07:00
Jeff King e9d7d10a7f mailinfo: avoid violating strbuf assertion
In handle_from, we calculate the end boundary of a section
to remove from a strbuf using strcspn like this:

  el = strcspn(buf, set_of_end_boundaries);
  strbuf_remove(&sb, start, el + 1);

This works fine if "el" is the offset of the boundary
character, meaning we remove up to and including that
character. But if the end boundary didn't match (that is, we
hit the end of the string as the boundary instead) then we
want just "el". Asking for "el+1" caught an out-of-bounds
assertion in the strbuf library.

This manifested itself when we got a 'From' header that had
just an email address with nothing else in it (the end of
the string was the end of the address, rather than, e.g., a
trailing '>' character), causing git-mailinfo to barf.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-19 19:36:56 -07:00
Jim Meyering c8c4450e19 git format-patch: avoid underrun when format.headers is empty or all NLs
* builtin-log.c (add_header): Avoid a buffer underrun when
format.headers is empty or all newlines.  Reproduce with this:
git config format.headers '' && git format-patch -1

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-19 18:08:00 -07:00
Brandon Casey 26e08a0190 t1002-read-tree-m-u-2way.sh: use 'git diff -U0' rather than 'diff -U0'
Some old platforms have an old diff which doesn't have the -U option.
'git diff' can be used in its place. Adjust the comparison function to
strip git's additional header lines to make this possible.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-18 23:27:14 -07:00
Robert Schiele da9973c6f9 adapt git-cvsserver manpage to dash-free syntax
Signed-off-by: Robert Schiele <rschiele@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-18 22:05:44 -07:00
Don Zickus 289796dd29 mailinfo: re-fix MIME multipart boundary parsing
Recent changes to is_multipart_boundary() caused git-mailinfo to segfault.
The reason was after handling the end of the boundary the code tried to look
for another boundary.  Because the boundary list was empty, dereferencing
the pointer to the top of the boundary caused the program to go boom.

The fix is to check to see if the list is empty and if so go on its merry
way instead of looking for another boundary.

I also fixed a couple of increments and decrements that didn't look correct
relating to content_top.

The boundary test case was updated to catch future problems like this again.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-18 22:05:02 -07:00
Junio C Hamano dba9194a49 Start 1.6.0.X maintenance series
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-17 15:44:11 -07:00
Junio C Hamano ea02eef096 GIT 1.6.0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-17 11:42:10 -07:00
Junio C Hamano 373a273309 Merge git-gui 0.11.0 2008-08-17 11:41:19 -07:00
Junio C Hamano a1975c4fea Merge branch 'ak/p4'
* ak/p4:
  Utilise our new p4_read_pipe and p4_write_pipe wrappers
  Add p4 read_pipe and write_pipe wrappers
  Put in the two other configuration elements found in the source
  Put some documentation in about the parameters that have been added
  Move git-p4.syncFromOrigin into a configuration parameters section
  Consistently use 'git-p4' for the configuration entries
  If the user has configured various parameters, use them.
  Switch to using 'p4_build_cmd'
  If we are in verbose mode, output what we are about to run (or return)
  Add a single command that will be used to construct the 'p4' command
  Utilise the new 'p4_system' function.
  Have a command that specifically invokes 'p4' (via system)
  Utilise the new 'p4_read_pipe_lines' command
  Create a specific version of the read_pipe_lines command for p4 invocations

Conflicts:
	contrib/fast-import/git-p4
2008-08-17 10:53:57 -07:00
Robert Blum 053fd0c1c3 git-p4: chdir now properly sets PWD environment variable in msysGit
P4 on Windows expects the PWD environment variable to be set to the
current working dir, but os.chdir in python doesn't do so.

Signed-off-by: Robert Blum <rob.blum@gmail.com>
Acked-by: Simon Hausmann <simon@lst.de>
Acked-by: Han-Wen Nienhuys <hanwen@xs4all.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-16 23:37:04 -07:00
Stephan Beyer 9b752a6e31 Improve error output of git-rebase
"git rebase" without arguments on initial startup showed:

	fatal: Needed a single revision
	invalid upstream

This patch makes it show the ordinary usage string.

If .git/rebase-merge or .git/rebase-apply/rebasing exists, git-rebase
will die with a message saying that a rebase is in progress and the user
should try --skip/--abort/--continue.

If .git/rebase-apply/applying exists, git-rebase will die with a message
saying that git-am is in progress, regardless how many arguments are
given.

If no arguments are given and .git/rebase-apply/ exists, but neither a
rebasing nor applying file is in that directory, git-rebase dies with a
message saying that rebase-apply exists and no arguments were given.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-16 23:21:18 -07:00
Miklos Vajna 20a55f4b2e t9300: replace '!' with test_must_fail
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-16 23:21:18 -07:00
Junio C Hamano a0d74d160f Merge git://git.kernel.org/pub/scm/gitk/gitk
* git://git.kernel.org/pub/scm/gitk/gitk:
  gitk: Allow safely calling nukefile from a run queue handler
2008-08-16 23:21:07 -07:00
Marcus Griep c14c8ceb13 Git.pm: Make File::Spec and File::Temp requirement lazy
This will ensure that the API at large is accessible to nearly
all Perl versions, while only the temp file caching API is tied to
the File::Temp and File::Spec modules being available.

Signed-off-by: Marcus Griep <marcus@griep.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-16 02:58:22 -07:00
Miklos Vajna 4370c2d620 Documentation: document the pager.* configuration setting
It was already documented in RelNotes-1.6.0, but not in the git-config
manual page.

Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-16 02:58:22 -07:00
Stephan Beyer a5ab00c5d2 git-stash: improve synopsis in help and manual page
"git stash -h" showed some incomplete and ugly usage information.
For example, the useful "--keep-index" option for "save" or the "--index"
option for  "apply" were not shown. Also in the documentation synopsis they
were not shown, so that there is no incentive to scroll down and even see
that such options exist.

This patch improves the git-stash synopsis in the documentation by
mentioning that further options to the stash commands and then copies
this synopsis to the usage information string of git-stash.sh.

For the latter, the dashless git command string has to be inserted on the
second and the following usage lines. The code of this is taken from
git-sh-setup so that all lines will show the command string.

Note that the "create" command is not advertised at all now, because
it was not mentioned in git-stash.txt.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-16 02:58:18 -07:00
Eric Blake 0d768f7c8f Makefile: building git in cygwin 1.7.0
On platforms with $X, make removes any leftover scripts 'a' from
earlier builds if a new binary 'a.exe' is now built.  However, on
cygwin 1.7.0, 'git' and 'git.exe' now consistently name the same file.
Test for file equality before attempting a remove, in order to avoid
nuking just-built binaries.

Signed-off-by: Eric Blake <ebb9@byu.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-16 02:34:23 -07:00
Stephan Beyer cb3a160d60 git-am: ignore --binary option
The git-apply documentation says that --binary is a historical option.
This patch lets git-am ignore --binary and removes advertisements of this
option.

Signed-off-by: Stephan Beyer <s-beyer@gmx.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-16 02:32:36 -07:00
Marcus Griep 2946cccfdf bash-completion: Add non-command git help files to bash-completion
Git allows access to the gitattributes man page via `git help attributes`,
but this is not discoverable via the bash-completion mechanism.  This
patch adds all current non-command man pages to the completion candidate
list.

Signed-off-by: Marcus Griep <marcus@griep.us>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-16 02:32:01 -07:00
Alex Riesen 8134a003e0 Fix t3700 on filesystems which do not support question marks in names
Use square brackets instead.

And the prominent example of the deficiency are, as usual, the filesystems
of Microsoft house.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-15 01:38:37 -07:00
Anand Kumria a7d3ef9d09 Utilise our new p4_read_pipe and p4_write_pipe wrappers
Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-14 18:14:24 -07:00
Anand Kumria d9429194f6 Add p4 read_pipe and write_pipe wrappers
Two additional wrappers to cover 3 places where we utilise p4 in piped
form.  Found by Tor Arvid Lund.

Signed-off-by: Anand Kumria <wildfire@progsoc.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-14 18:14:23 -07:00
Lee Marlow 5a13c8f6f7 bash completion: Add '--merge' long option for 'git log'
Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-14 17:49:12 -07:00
Lee Marlow b4c72162f6 bash completion: Add completion for 'git mergetool'
The --tool= long option to "git mergetool" can be completed with:

	kdiff3 tkdiff meld xxdiff emerge
	vimdiff gvimdiff ecmerge opendiff

Signed-off-by: Lee Marlow <lee.marlow@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-14 17:49:12 -07:00
Matt McCutchen f491239170 git format-patch documentation: clarify what --cover-letter does
Signed-off-by: Matt McCutchen <matt@mattmccutchen.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-14 17:49:12 -07:00
Eric Raible 7950659dc9 bash completion: 'git apply' should use 'fix' not 'strip'
Bring completion up to date with the man page.

Signed-off-by: Eric Raible <raible@gmail.com>
Acked-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-14 17:49:12 -07:00
Junio C Hamano a0653d5505 Merge branch 'maint'
* maint:
  t5304-prune: adjust file mtime based on system time rather than file mtime
  Fix escaping of glob special characters in pathspecs
2008-08-13 19:22:29 -07:00
Brandon Casey 21926fe885 t5304-prune: adjust file mtime based on system time rather than file mtime
test-chmtime can adjust the mtime of a file based on the file's mtime, or
based on the system time. For files accessed over NFS, the file's mtime is
set by the NFS server, and as such may vary a great deal from the NFS
client's system time if the clocks of the client and server are out of
sync. Since these tests are testing the expire feature of git-prune, an
incorrect mtime could cause a file to be expired or not expired incorrectly
and produce a test failure.

Avoid this NFS pitfall by modifying the calls to test-chmtime so that the
mtime is adjusted based on the system time, rather than the file's mtime.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-13 18:18:23 -07:00
Brandon Casey 8caa3acf3a test-parse-options: use appropriate cast in length_callback
OPT_CALLBACK() is passed &integer which is now an "int" rather than
"unsigned long". Update the length_callback function.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-13 18:11:44 -07:00
Kevin Ballard ea335b56d4 Fix escaping of glob special characters in pathspecs
match_one implements an optimized pathspec match where it only uses
fnmatch if it detects glob special characters in the pattern. Unfortunately
it didn't treat \ as a special character, so attempts to escape a glob
special character would fail even though fnmatch() supports it.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-13 17:11:03 -07:00
Thomas Rast a96dc01e21 rebase -i -p: fix parent rewriting
The existing parent rewriting did not handle the case where a previous
commit was amended (via edit or squash).  Fix by always putting the
new sha1 of the last commit into the $REWRITTEN map.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
2008-08-13 15:17:10 -07:00
Thomas Rast 71d9451e06 rebase -i -p: handle index and workdir correctly
'git rebase -i -p' forgot to update the index and working directory
during fast forwards.  Fix this.  Makes 'GIT_EDITOR=true rebase -i -p
<ancestor>' a no-op again.

Also, it attempted to do a fast forward even if it was instructed not
to commit (via -n).  Fall back to the cherry-pick code path and let
that handle the issue for us.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
2008-08-13 15:17:09 -07:00
Junio C Hamano 65f59e2998 GIT 1.6.0-rc3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-12 22:46:33 -07:00
Junio C Hamano fc721b699b Merge branch 'maint'
* maint:
  Do not talk about "diff" in rev-list documentation.
2008-08-12 22:46:22 -07:00
Junio C Hamano 9612e74342 Do not talk about "diff" in rev-list documentation.
Since 8c02eee (git-rev-list(1): group options; reformat; document more
options, 2006-09-01), git-rev-list documentation talks as if it supports
any kind of diff output.  It doesn't.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-12 22:40:44 -07:00
Junio C Hamano c67a9e2682 Merge git://git.bogomips.org/git-svn
* git://git.bogomips.org/git-svn:
  git-svn: Reduce temp file usage when dealing with non-links
  git-svn: Make it incrementally faster by minimizing temp files
  Git.pm: Add faculties to allow temp files to be cached
2008-08-12 21:41:29 -07:00
Marcus Griep 510b0945d0 git-svn: Reduce temp file usage when dealing with non-links
Currently, in sub 'close_file', git-svn creates a temporary file and
copies the contents of the blob to be written into it. This is useful
for symlinks because svn stores symlinks in the form:

link $FILE_PATH

Git creates a blob only out of '$FILE_PATH' and uses file mode to
indicate that the blob should be interpreted as a symlink.

As git-hash-object is invoked with --stdin-paths, a duplicate of the
link from svn must be created that leaves off the first five bytes,
i.e. 'link '. However, this is wholly unnecessary for normal blobs,
though, as we already have a temp file with their contents. Copying
the entire file gains nothing, and effectively requires a file to be
written twice before making it into the object db.

This patch corrects that issue, holding onto the substr-like
duplication for symlinks, but skipping it altogether for normal blobs
by reusing the existing temp file.

Signed-off-by: Marcus Griep <marcus@griep.us>
Acked-by: Eric Wong <normalperson@yhbt.net>
2008-08-12 20:46:54 -07:00