summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2008-09-06builtin-merge: release the lockfile in try_merge_strategy()Libravatar Miklos Vajna2-0/+23
Once we committed the locked index, we should release the lockfile. In most cases this is done automatically when the process ends, but this is not true in this case. [jc: with additional tests from Eric Raible] Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-05merge-recursive: get rid of virtual_idLibravatar Miklos Vajna1-5/+1
We now just leave the object->sha1 field of virtual commits 0{40} as it is initialized, as a unique hash is not necessary in case of virtual commits. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-04merge-recursive: move current_{file,directory}_set to struct merge_optionsLibravatar Miklos Vajna2-27/+34
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
2008-09-04merge-recursive: move the global obuf to struct merge_optionsLibravatar Miklos Vajna2-19/+19
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
2008-09-04merge-recursive: get rid of the index_only global variableLibravatar Miklos Vajna1-73/+67
struct merge_options already has a call_depth member, and index_only global variable always equals to !!call_depth. We always use index_only as a condition, so we can just use call_depth instead of index_only. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
2008-09-03merge-recursive: move call_depth to struct merge_optionsLibravatar Miklos Vajna2-13/+13
Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>
2008-09-02cherry-pick/revert: make direct internal call to merge_tree()Libravatar Miklos Vajna1-40/+43
Refactored merge-recursive interface may still not be ideal but it already allows us to make a direct call to merge_tree(). One regression is that the status message is lost as there is no way to flush them from outside the refactored library code yet. [jc: initial version by Miklos, with moderate amount of fixup by me] Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-30builtin-merge: avoid run_command_v_opt() for recursive and subtreeLibravatar Miklos Vajna1-29/+63
The try_merge_strategy() function always ran the strategy in a separate process, though this is not always necessary. The recursive and subtree strategy can be called without a fork(). This patch adds a check, and calls recursive in the same process without wasting resources. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-30merge-recursive: introduce merge_optionsLibravatar Miklos Vajna4-169/+192
This makes it possible to avoid passing the labels of branches as arguments to merge_recursive(), merge_trees() and merge_recursive_generic(). It also takes care of subtree merge, output buffering, verbosity, and rename limits - these were global variables till now in merge-recursive.c. A new function, named init_merge_options(), is introduced as well, it clears the struct merge_info, then initializes with default values, finally updates the default values based on the config and environment variables. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-30merge-recursive.c: Add more generic merge_recursive_generic()Libravatar Stephan Beyer3-46/+75
merge_recursive_generic() takes, in comparison to to merge_recursive(), no commit ("struct commit *") arguments but SHA ids ("unsigned char *"), and no commit list of bases but an array of refs ("const char **"). This makes it more generic in the case that it can also take the SHA of a tree to merge trees without commits, for the bases, the head and the remote. merge_recursive_generic() also handles locking and updating of the index, which is a common use case of merge_recursive(). This patch also rewrites builtin-merge-recursive.c to make use of merge_recursive_generic(). By doing this, I stumbled over the limitation of 20 bases and I've added a warning if this limitation is exceeded. This patch qualifies make_virtual_commit() as static again because this function is not needed anymore outside merge-recursive.c. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-30Split out merge_recursive() to merge-recursive.cLibravatar Miklos Vajna4-1324/+1341
Move most of the of code from builtin-merge-recursive.c to a new file merge-recursive.c and introduce merge_recursive_setup() in there so that builtin-merge-recursive and other builtins call it. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-30Merge branch 'maint'Libravatar Junio C Hamano7-13/+146
* maint: gitattributes: -crlf is not binary git-apply: Loosen "match_beginning" logic Fix example in git-name-rev documentation shell: do not play duplicated definition games to shrink the executable Fix use of hardlinks in "make install" pack-objects: Allow missing base objects when creating thin packs
2008-08-30gitattributes: -crlf is not binaryLibravatar Junio C Hamano1-3/+37
The description of crlf attribute incorrectly said that "-crlf" means binary. It is true that for binary files you would want "-crlf", but that is not the same thing. We also have supported attribute macros and via that mechanism a handy "binary" to specify "-crlf -diff" at the same time. It was not documented anywhere as far as I can tell, even though the support was there from the very beginning. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-30git-apply: Loosen "match_beginning" logicLibravatar Junio C Hamano2-4/+16
Even after a handfle attempts, match_beginning logic still has corner cases: 1bf1a85 (apply: treat EOF as proper context., 2006-05-23) 65aadb9 (apply: force matching at the beginning., 2006-05-24) 4be6096 (apply --unidiff-zero: loosen sanity checks ..., 2006-09-17) ee5a317 (Fix "git apply" to correctly enforce "match ..., 2008-04-06) This is a tricky piece of code. We still incorrectly enforce "match_beginning" for -U0 matches. I noticed this while trying out an example sequence from Clemens Buchacher: $ echo a >victim $ git add victim $ echo b >>victim $ git diff -U0 >patch $ cat patch diff --git i/victim w/victim index 7898192..422c2b7 100644 --- i/victim +++ w/victim @@ -1,0 +2 @@ a +b $ git apply --cached --unidiff-zero <patch $ git show :victim b a The change inserts a new line before the second line, but we insist it to be applied at the beginning. As the result, the code refuses to apply it at the original offset, and we end up adding the line at the beginning. Updates to the test script are by Clemens Buchacher. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-30Fix example in git-name-rev documentationLibravatar Junio C Hamano1-1/+1
Since 59d3f54 (name-rev: avoid "^0" when unneeded, 2007-02-20), name-rev stopped showing an unnecessary "^0" to dereference a tag down to a commit. The patch should have made a matching update to the documentation, but we forgot. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-30Merge branch 'sp/missing-thin-base' into maintLibravatar Junio C Hamano2-4/+91
* sp/missing-thin-base: pack-objects: Allow missing base objects when creating thin packs
2008-08-30Merge branch 'sb/daemon'Libravatar Junio C Hamano2-197/+107
* sb/daemon: daemon.c: minor style fixup git-daemon: rewrite kindergarden, new option --max-connections git-daemon: Simplify dead-children reaping logic git-daemon: use LOG_PID, simplify logging code git-daemon: call logerror() instead of error()
2008-08-29Merge branch 'af/maint-install-no-handlink' into maintLibravatar Junio C Hamano1-11/+11
* af/maint-install-no-handlink: Fix use of hardlinks in "make install" Makefile: always provide a fallback when hardlinks fail
2008-08-29shell: do not play duplicated definition games to shrink the executableLibravatar Junio C Hamano2-16/+1
Playing with linker games to shrink git-shell did not go well with various other platforms and compilers. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-29Fix use of hardlinks in "make install"Libravatar Alex Riesen1-1/+1
The code failed to filter-out git-add properly on platforms were $X is not empty (ATM there is only one such a platform). Than it tried to create a hardlink to the file ($execdir/git-add) it just removed (because git-add is first in the BUILT_INS), so ln failed (but because stderr was redirected into /dev/null the error was never seen), and the whole install ended up using "ln -s" instead. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-29Merge branch 'np/verify-pack' into maintLibravatar Junio C Hamano5-1/+22
* np/verify-pack: discard revindex data when pack list changes
2008-08-29Merge branch 'maint'Libravatar Junio C Hamano11-12/+80
* maint: tutorial: gentler illustration of Alice/Bob workflow using gitk pretty=format: respect date format options make git-shell paranoid about closed stdin/stdout/stderr Document gitk --argscmd flag. Fix '--dirstat' with cross-directory renaming for-each-ref: Allow a trailing slash in the patterns
2008-08-29git-p4: Fix checkout bug when using --import-local.Libravatar Tor Arvid Lund1-2/+6
When this option is passed to git p4 clone, the checkout at the end would previously fail. This patch fixes it by optionally creating the master branch from refs/heads/p4/master, which is the correct one for this option. Signed-off-by: Tor Arvid Lund <torarvid@gmail.com> Acked-By: Simon Hausmann <simon@lst.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-29tutorial: gentler illustration of Alice/Bob workflow using gitkLibravatar Paolo Ciarrocchi1-1/+28
Update to gitutorial as discussedin the git mailing list: http://marc.info/?t=121969390900002&r=1&w=2 Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-29pretty=format: respect date format optionsLibravatar Jeff King6-10/+22
When running a command like: git log --pretty=format:%ad --date=short the date option was ignored. This patch causes it to use whatever format was specified by --date (or by --relative-date, etc), just as the non-user formats would do. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-29make git-shell paranoid about closed stdin/stdout/stderrLibravatar Paolo Bonzini1-0/+13
It is in general unsafe to start a program with one or more of file descriptors 0/1/2 closed. Karl Chen for example noticed that stat_command does this in order to rename a pipe file descriptor to 0: dup2(from, 0); close(from); ... but if stdin was closed (for example) from == 0, so that dup2(0, 0); close(0); just ends up closing the pipe. Another extremely rare but nasty problem would occur if an "important" file ends up in file descriptor 2, and is corrupted by a call to die(). Fixing this in git was considered to be overkill, so this patch works around it only for git-shell. The fix is simply to open all the "low" descriptors to /dev/null in main. Signed-off-by: Paolo Bonzini <bonzini@gnu.org> Acked-by: Stephen R. van den Berg <srb@cuci.nl> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-29Document gitk --argscmd flag.Libravatar Yann Dirson1-0/+7
This was part of my original patch, but appears to have been lost. Signed-off-by: Yann Dirson <ydirson@altern.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-29Fix '--dirstat' with cross-directory renamingLibravatar Linus Torvalds1-0/+8
The dirstat code depends on the fact that we always generate diffs with the names sorted, since it then just does a single-pass walk-over of the sorted list of names and how many changes there were. The sorting means that all files are nicely grouped by directory. That all works fine. Except when we have rename detection, and suddenly the nicely sorted list of pathnames isn't all that sorted at all. And now the single-pass dirstat walk gets all confused, and you can get results like this: [torvalds@nehalem linux]$ git diff --dirstat=2 -M v2.6.27-rc4..v2.6.27-rc5 3.0% arch/powerpc/configs/ 6.8% arch/arm/configs/ 2.7% arch/powerpc/configs/ 4.2% arch/arm/configs/ 5.6% arch/powerpc/configs/ 8.4% arch/arm/configs/ 5.5% arch/powerpc/configs/ 23.3% arch/arm/configs/ 8.6% arch/powerpc/configs/ 4.0% arch/ 4.4% drivers/usb/musb/ 4.0% drivers/watchdog/ 7.6% drivers/ 3.5% fs/ The trivial fix is to add a sorting pass, fixing it to: [torvalds@nehalem linux]$ git diff --dirstat=2 -M v2.6.27-rc4..v2.6.27-rc5 43.0% arch/arm/configs/ 25.5% arch/powerpc/configs/ 5.3% arch/ 4.4% drivers/usb/musb/ 4.0% drivers/watchdog/ 7.6% drivers/ 3.5% fs/ Spot the difference. In case anybody wonders: it's because of a ton of renames from {include/asm-blackfin => arch/blackfin/include/asm} that just totally messed up the file ordering in between arch/arm and arch/powerpc. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-29for-each-ref: Allow a trailing slash in the patternsLibravatar Björn Steinbrink1-1/+2
More often than not, I end up using something like refs/remotes/ as the pattern for for-each-ref, but that doesn't work, because it expects to see the slash in the ref name right after the matched pattern. So teach it to accept the slash as the final character in the pattern as well. Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-28list_commands: only call git_exec_path if it is neededLibravatar Alex Riesen1-1/+1
Even if it always needed Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-28Allow git help work without PATH setLibravatar Alex Riesen1-23/+20
Just because we can Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-28Make main_cmds and other_cmds local to builtin-help.cLibravatar Alex Riesen1-1/+1
These are not used anywhere else. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-28Remove useless memset of static command name lists in builtin-merge.cLibravatar Alex Riesen1-2/+0
The statics are always initialized with 0 Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-28Remove calculation of the longest command name from where it is not usedLibravatar Alex Riesen4-28/+24
Just calculate it where it is needed - it is cheap and trivial, as all the lengths are already there (stored when creating the command lists). Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-28dir.c: Avoid c99 array initializationLibravatar Brandon Casey3-16/+10
The following syntax: char foo[] = { [0] = 1, [7] = 2, [15] = 3 }; is a c99 construct which some compilers do not support even though they support other c99 constructs. This construct can be avoided by folding these 'special' test cases into the sane_ctype array and making use of the related infrastructure. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-28bash-completion: Add all submodule subcommands to the completion listLibravatar Matthias Kestenholz1-1/+1
Signed-off-by: Matthias Kestenholz <mk@spinlock.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-27Merge branch 'mv/merge-custom'Libravatar Junio C Hamano8-508/+627
* mv/merge-custom: t7606: fix custom merge test Fix "git-merge -s bogo" help text Update .gitignore to ignore git-help Builtin git-help. builtin-help: always load_command_list() in cmd_help() Add a second testcase for handling invalid strategies in git-merge Add a new test for using a custom merge strategy builtin-merge: allow using a custom strategy builtin-help: make some internal functions available to other builtins Conflicts: help.c
2008-08-27Merge branch 'ml/submodule'Libravatar Junio C Hamano1-1/+2
* ml/submodule: git-submodule.sh - Remove trailing / from URL if found git-submodule.sh - Remove trailing / from URL if found
2008-08-27Merge branch 'am/cherry-pick-rerere'Libravatar Junio C Hamano2-0/+47
* am/cherry-pick-rerere: Make cherry-pick use rerere for conflict resolution.
2008-08-27Merge branch 'jc/add-addremove'Libravatar Junio C Hamano3-69/+93
* jc/add-addremove: builtin-add.c: optimize -A option and "git add ." builtin-add.c: restructure the code for maintainability
2008-08-27Merge branch 'np/verify-pack'Libravatar Junio C Hamano5-1/+22
* np/verify-pack: discard revindex data when pack list changes
2008-08-27Merge branch 'da/submodule-sync'Libravatar Junio C Hamano2-2/+55
* da/submodule-sync: git-submodule: add "sync" command
2008-08-27Merge branch 'maint'Libravatar Junio C Hamano3-1/+6
* maint: ctype.c: protect tiny C preprocessor constants index-pack: be careful after fixing up the header/footer
2008-08-27ctype.c: protect tiny C preprocessor constantsLibravatar Junio C Hamano1-0/+5
Some platforms contaminate the preprocessor token namespace with their own definition of SS without being asked. Avoid getting hit by redefinition warning messages by explicitly undef SS, AA and DD shorthand we use in this table definition. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-27index-pack: be careful after fixing up the header/footerLibravatar Linus Torvalds2-1/+1
The index-pack command, when processing a thin pack, fixed up the pack after-the-fact. It forgets to fsync the result, because it only did that in one path rather in all cases of fixup. This moves the fsync_or_die() to the fix-up routine itself, rather than doing it in one of the callers, so that all cases are covered. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-27Make it possible to abort the submission of a change to PerforceLibravatar Simon Hausmann1-8/+23
Currently it is not possible to skip the submission of a change to Perforce when running git-p4 submit. This patch compares the modification time before and after the submit editor invokation and offers a prompt for skipping if the submit template file was not saved. Signed-off-by: Simon Hausmann <simon@lst.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-26Merge branch 'af/maint-install-no-handlink'Libravatar Junio C Hamano1-11/+11
* af/maint-install-no-handlink: Makefile: always provide a fallback when hardlinks fail
2008-08-26Merge branch 'jc/no-slim-shell'Libravatar Junio C Hamano4-6/+3
* jc/no-slim-shell: Revert "Build-in "git-shell""
2008-08-26Merge branch 'maint'Libravatar Junio C Hamano9-35/+46
* maint: index-pack: setup git repository Suppress some bash redirection error messages Fix a warning (on cygwin) to allow -Werror Fix "git log -i --grep"
2008-08-26format-patch: use default diff format even with patch optionsLibravatar Jeff King2-1/+27
Previously, running "git format-patch -U5" would cause the low-level diff machinery to change the diff output format from "not specified" to "patch". This meant that format-patch thought we explicitly specified a diff output format, and would not use the default format. The resulting message lacked both the diffstat and the summary, as well as the separating "---". Now format-patch explicitly checks for this condition and uses the default. That means that "git format-patch -p" will now have the "-p" ignored. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>