summaryrefslogtreecommitdiff
path: root/builtin
AgeCommit message (Collapse)AuthorFilesLines
2010-12-10Merge branch 'mg/maint-tag-rfc1991' into maintLibravatar Junio C Hamano2-20/+6
* mg/maint-tag-rfc1991: tag: recognize rfc1991 signatures tag: factor out sig detection for tag display tag: factor out sig detection for body edits verify-tag: factor out signature detection t/t7004-tag: test handling of rfc1991 signatures
2010-12-09Merge branch 'jn/cherry-pick-refresh-index' into maintLibravatar Junio C Hamano1-2/+16
* jn/cherry-pick-refresh-index: cherry-pick/revert: transparently refresh index
2010-12-09Merge branch 'fc/apply-p2-get-header-name' into maintLibravatar Junio C Hamano1-14/+14
* fc/apply-p2-get-header-name: test: git-apply -p2 rename/chmod only Fix git-apply with -p greater than 1
2010-12-09Merge branch 'np/pack-broken-boundary' into maintLibravatar Junio C Hamano1-1/+15
* np/pack-broken-boundary: make pack-objects a bit more resilient to repo corruption
2010-12-09Merge branch 'ak/apply-non-git-epoch' into maintLibravatar Junio C Hamano1-6/+29
* ak/apply-non-git-epoch: apply: handle patches with funny filename and colon in timezone apply: Recognize epoch timestamps with : in the timezone
2010-12-02Merge branch 'cb/maint-orphan-merge-noclobber' into maintLibravatar Junio C Hamano1-1/+19
* cb/maint-orphan-merge-noclobber: do not overwrite untracked during merge from unborn branch
2010-12-02Merge branch 'tr/maint-merge-file-subdir' into maintLibravatar Junio C Hamano1-1/+6
* tr/maint-merge-file-subdir: merge-file: correctly find files when called in subdir prefix_filename(): safely handle the case where pfx_len=0
2010-12-02Merge branch 'ks/no-textconv-symlink' into maintLibravatar Junio C Hamano2-12/+23
* 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
2010-12-01Merge branch 'maint-1.7.2' into maintLibravatar Junio C Hamano1-1/+2
* maint-1.7.2: add: introduce add.ignoreerrors synonym for add.ignore-errors bash: Match lightweight tags in prompt git-commit.txt: (synopsis): move -i and -o before "--"
2010-12-01Merge branch 'maint-1.7.1' into maint-1.7.2Libravatar Junio C Hamano1-1/+2
* maint-1.7.1: add: introduce add.ignoreerrors synonym for add.ignore-errors
2010-12-01Merge branch 'maint-1.7.0' into maint-1.7.1Libravatar Junio C Hamano1-1/+2
* maint-1.7.0: add: introduce add.ignoreerrors synonym for add.ignore-errors
2010-11-24Merge branch 'jk/maint-apply-no-binary' into maintLibravatar Junio C Hamano1-0/+6
* jk/maint-apply-no-binary: apply: don't segfault on binary files with missing data
2010-11-24Merge branch 'jn/send-pack-error' into maintLibravatar Junio C Hamano1-1/+1
* jn/send-pack-error: send-pack: avoid redundant "pack-objects died with strange error"
2010-11-24Merge branch 'jk/maint-rev-list-nul' into maintLibravatar Junio C Hamano1-2/+4
* jk/maint-rev-list-nul: rev-list: handle %x00 NUL in user format
2010-11-24Merge branch 'bc/fix-cherry-pick-root' into maintLibravatar Junio C Hamano1-1/+1
* bc/fix-cherry-pick-root: builtin/revert.c: don't dereference a NULL pointer
2010-11-17clean: remove redundant variable baselenLibravatar Nguyễn Thái Ngọc Duy1-2/+2
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>
2010-11-16clean: avoid quoting twiceLibravatar Nguyễn Thái Ngọc Duy1-2/+2
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>
2010-11-15do not overwrite untracked during merge from unborn branchLibravatar Clemens Buchacher1-1/+19
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>
2010-11-10tag: factor out sig detection for tag displayLibravatar Michael J Gruber1-2/+2
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>
2010-11-10tag: factor out sig detection for body editsLibravatar Michael J Gruber1-10/+2
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>
2010-11-10verify-tag: factor out signature detectionLibravatar Michael J Gruber1-8/+2
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>
2010-11-10cherry-pick/revert: transparently refresh indexLibravatar Jonathan Nieder1-2/+16
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>
2010-11-10apply: handle patches with funny filename and colon in timezoneLibravatar Jonathan Nieder1-2/+22
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>
2010-11-05Fix git-apply with -p greater than 1Libravatar Federico Cuello1-14/+14
Fix the case when the patch is a rename or mode-change only and -p is used with a value greater than one. The git_header_name function did not remove more than one path component. Signed-off-by: Federico Cuello <fedux@lugmen.org.ar> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-29apply: don't segfault on binary files with missing dataLibravatar Jeff King1-0/+6
Usually when applying a binary diff generated without --binary, it will be rejected early, as we don't even have the full sha1 of the pre- and post-images. However, if the diff is generated with --full-index (but not --binary), then we will actually try to apply it. If we have the postimage blob, then we can take a shortcut and never even look at the binary diff at all (e.g., this can happen when rebasing changes within a repository). If we don't have the postimage blob, though, we try to look at the actual fragments, of which there are none, and get a segfault. This patch checks explicitly for that case and complains to the user instead of segfaulting. We need to keep the check at a low level so that the "shortcut" case above continues to work. We also add a test that demonstrates the segfault. While we're at it, let's also explicitly test the shortcut case. Reported-by: Rafaël Carré <rafael.carre@gmail.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-22make pack-objects a bit more resilient to repo corruptionLibravatar Nicolas Pitre1-1/+15
Right now, packing valid objects could fail when creating a thin pack simply because a pack edge object used as a preferred base is corrupted. Since preferred base objects are not strictly needed to produce a valid pack, let's not consider the inability to read them as a fatal error. Delta compression may well be attempted against other objects in the search window. To avoid warning storms (we are in the inner loop of the delta search window) a warning is emitted only on the first occurrence. Signed-off-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-18send-pack: avoid redundant "pack-objects died with strange error"Libravatar Jonathan Nieder1-1/+1
Saying "pack-objects died with strange error" after "pack-objects died of signal 13" seems kind of redundant. The latter message was introduced when the run-command API changed to report abnormal exits on behalf of the caller (v1.6.5-rc0~86^2~5, 2009-07-04). Similarly, after a controlled pack-objects failure (detectable as a normal exit with nonzero status), a "died with strange error" message would be redundant next to the message from pack-objects itself. So leave off the "strange error" messages. The result should look something like this: $ git push sf master Counting objects: 21542, done. Compressing objects: 100% (4179/4179), done. fatal: Unable to create temporary file: Permission denied error: pack-objects died of signal 13 error: failed to push some refs to 'ssh://sf.net/gitroot/project/project' $ Or in the "controlled exit" case (contrived example): [...] fatal: delta size changed error: failed to push some refs to 'ssh://example.com/foo/bar' $ Improved-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-18merge-file: correctly find files when called in subdirLibravatar Thomas Rast1-1/+6
Since b541248 (merge.conflictstyle: choose between "merge" and "diff3 -m" styles, 2008-08-29), git-merge-file uses setup_directory_gently(), thus cd'ing around to find any possible config files to use. This broke merge-file when it is called from within a subdirectory of a repository, and the arguments are all relative paths. Fix by prepending the prefix, as passed down from the main git setup code, if there is any. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-13rev-list: handle %x00 NUL in user formatLibravatar Jeff King1-2/+4
The code paths for showing commits in "git log" and "git rev-list --graph" correctly handle embedded NULs by looking only at the resulting strbuf's length, and never treating it as a C string. The code path for regular rev-list, however, used printf("%s"), which resulted in truncated output. This patch uses fwrite instead, like the --graph code path. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-13apply: Recognize epoch timestamps with : in the timezoneLibravatar Anders Kaseorg1-4/+7
Some patches have a timezone formatted like ‘-08:00’ instead of ‘-0800’ (e.g. http://lwn.net/Articles/131729/), so git apply would fail to recognize the epoch timestamp of deleted files and would create empty files instead. Teach it to support both formats, and add a test case. Signed-off-by: Anders Kaseorg <andersk@mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-08Fix {update,checkout}-index usage stringsLibravatar Štěpán Němec2-2/+2
The `<file>' argument is optional in both cases (the man pages are already correct). Signed-off-by: Štěpán Němec <stepnem@gmail.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-08Put a space between `<' and argument in pack-objects usage stringLibravatar Štěpán Němec1-1/+1
This makes it cosistent with other places (including the git-pack-objects(1) manpage itself) and avoids possible confusion (I, for one, mistook `<object-list' for a `<object-list>' typo at first when preparing this series). Signed-off-by: Štěpán Němec <stepnem@gmail.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-08Use parentheses and `...' where appropriateLibravatar Štěpán Němec8-8/+8
Remove some stray usage of other bracket types and asterisks for the same purpose. Signed-off-by: Štěpán Němec <stepnem@gmail.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-08Use angles for placeholders consistentlyLibravatar Štěpán Němec6-12/+12
Signed-off-by: Štěpán Němec <stepnem@gmail.com> Acked-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06do not depend on signed integer overflowLibravatar Erik Faye-Lund3-3/+3
Signed integer overflow is not defined in C, so do not depend on it. This fixes a problem with GCC 4.4.0 and -O3 where the optimizer would consider "consumed_bytes > consumed_bytes + bytes" as a constant expression, and never execute the die()-call. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Acked-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-10-06init: plug tiny one-time memory leakLibravatar Jonathan Nieder1-13/+19
The buffer used to construct paths like ".git/objects/info" and ".git/objects/pack" is allocated on the heap and never freed. So free it. While at it, factor out the relevant code into its own function and rename the sha1_dir variable to object_directory (to match the change in everyday usage after the renaming of SHA1_FILE_DIRECTORY in v0.99~603^2~7, 2005). Noticed by valgrind while setting up tests (in test-lib). Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-30Fix typo in pack-objects' usageLibravatar Johannes Schindelin1-1/+1
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-29blame,cat-file --textconv: Don't assume mode is ``S_IFREF | 0664''Libravatar Kirill Smelkov2-12/+23
We need to get the correct mode when blame reads the source from the working tree, the index, or trees. This allows us to omit running textconv filters on symbolic links. Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru> Reviewed-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-27Improvements to `git checkout -h`Libravatar Daniel Knittl-Frank1-6/+6
be a little more verbose about what each option does Signed-off-by: Daniel Knittl-Frank <knittl89+git@googlemail.com> Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-27builtin/revert.c: don't dereference a NULL pointerLibravatar Brandon Casey1-1/+1
cherry-pick will segfault when transplanting a root commit if the --ff option is used. This happens because the "parent" pointer is set to NULL when the commit being cherry-picked has no parents. Later, when "parent" is dereferenced, the cherry-pick segfaults. Fix this by checking whether "parent" is NULL before dereferencing it and add a test for this case of cherry-picking a root commit with --ff. Reported-by: Zbyszek Szmek <zbyszek@in.waw.pl> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-15Merge branch 'dr/maint-ls-tree-prefix-recursion-fix'Libravatar Junio C Hamano1-0/+2
* dr/maint-ls-tree-prefix-recursion-fix: ls-tree $di $dir: do not mistakenly recurse into directories
2010-09-12ls-tree $di $dir: do not mistakenly recurse into directoriesLibravatar Junio C Hamano1-0/+2
When applying two pathspecs, one of which is named as a prefix to the other, we mistakenly recursed into the shorter one. Noticed and fixed by David Reis. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-09builtin/fetch.c: comment that branch->remote_name is usable when has_mergeLibravatar Brandon Casey1-0/+3
Save future readers the trouble of tracing code to determine that the two uses of branch->remote_name are safe when has_merge is set, by adding a comment explaining that it is so. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-08Merge branch 'jh/error-removing-missing-note'Libravatar Junio C Hamano1-4/+10
* jh/error-removing-missing-note: notes: Don't create (empty) commit when removing non-existing notes
2010-09-08Merge branch 'bc/maint-fetch-url-only'Libravatar Junio C Hamano1-1/+3
* bc/maint-fetch-url-only: builtin/fetch.c: ignore merge config when not fetching from branch's remote t/t5510: demonstrate failure to fetch when current branch has merge ref
2010-09-08Merge branch 'en/d-f-conflict-fix'Libravatar Junio C Hamano1-1/+9
* en/d-f-conflict-fix: fast-export: ensure that a renamed file is printed after all references
2010-09-08fast-export: ensure that a renamed file is printed after all referencesLibravatar Johannes Sixt1-1/+9
t9350 sets up a commit where a file is both copied and renamed. The output of fast-export for this commit should look like this: author ... committer ... from :19 C "file2" "file4" R "file2" "file5" The order of the two modification lines is derived from the result that the diff machinery produces. 060df62 (fast-export: Fix output order of D/F changes) inserted a qsort call that modifies the order of the diff result. Unfortunately, qsort need not be stable. Therefore, it is possible that the 'R' line appears before the 'C' line and the resulting fast-import stream is incorrect. Fix it by forcing that the rename entry is printed after all other modification lines with the same file name. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-06revert: Fix trivial comment style issueLibravatar Elijah Newren1-1/+0
Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-09-06Merge branch 'jh/clean-exclude'Libravatar Junio C Hamano1-1/+1
* jh/clean-exclude: builtin/clean.c: Use STRING_LIST_INIT_NODUP.
2010-09-06builtin/clean.c: Use STRING_LIST_INIT_NODUP.Libravatar Thiago Farina1-1/+1
Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>