From 7e09b1531faa260226e0d4f7c850660b7ccb2f04 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 27 Jul 2008 10:34:21 +0400 Subject: [PATCH 01/95] git-gui: Fix the Remote menu separator. It was positioned incorrectly (offset by one position) if the menu had a tear-off handle. Signed-off-by: Alexander Gavrilov Signed-off-by: Shawn O. Pearce --- git-gui.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/git-gui.sh b/git-gui.sh index 7c27a43a5d..ce941adf8d 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -2925,6 +2925,7 @@ if {[is_enabled transport]} { populate_fetch_menu set n [expr {[.mbar.remote index end] - $n}] if {$n > 0} { + if {[.mbar.remote type 0] eq "tearoff"} { incr n } .mbar.remote insert $n separator } unset n From 25b8fb1e499d0e198e491d10c7023a5f5589e837 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 27 Jul 2008 10:35:38 +0400 Subject: [PATCH 02/95] git-gui: Preserve scroll position on reshow_diff. It is especially useful for Stage/Unstage Line, because they invoke full state scan and diff reload, which originally would reset the scroll position to the top of the file. Signed-off-by: Alexander Gavrilov Signed-off-by: Shawn O. Pearce --- lib/diff.tcl | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/diff.tcl b/lib/diff.tcl index 77990c537c..52b79e4a1f 100644 --- a/lib/diff.tcl +++ b/lib/diff.tcl @@ -19,6 +19,7 @@ proc clear_diff {} { proc reshow_diff {} { global file_states file_lists global current_diff_path current_diff_side + global ui_diff set p $current_diff_path if {$p eq {}} { @@ -28,7 +29,8 @@ proc reshow_diff {} { || [lsearch -sorted -exact $file_lists($current_diff_side) $p] == -1} { clear_diff } else { - show_diff $p $current_diff_side + set save_pos [lindex [$ui_diff yview] 0] + show_diff $p $current_diff_side {} $save_pos } } @@ -52,7 +54,7 @@ A rescan will be automatically started to find other files which may have the sa rescan ui_ready 0 } -proc show_diff {path w {lno {}}} { +proc show_diff {path w {lno {}} {scroll_pos {}}} { global file_states file_lists global is_3way_diff diff_active repo_config global ui_diff ui_index ui_workdir @@ -151,6 +153,10 @@ proc show_diff {path w {lno {}}} { $ui_diff conf -state disabled set diff_active 0 unlock_index + if {$scroll_pos ne {}} { + update + $ui_diff yview moveto $scroll_pos + } ui_ready return } @@ -190,10 +196,10 @@ proc show_diff {path w {lno {}}} { -blocking 0 \ -encoding binary \ -translation binary - fileevent $fd readable [list read_diff $fd] + fileevent $fd readable [list read_diff $fd $scroll_pos] } -proc read_diff {fd} { +proc read_diff {fd scroll_pos} { global ui_diff diff_active global is_3way_diff current_diff_header @@ -282,6 +288,10 @@ proc read_diff {fd} { close $fd set diff_active 0 unlock_index + if {$scroll_pos ne {}} { + update + $ui_diff yview moveto $scroll_pos + } ui_ready if {[$ui_diff index end] eq {2.0}} { From 79317e5df184773f3211503be49b8836b712facc Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 29 Jul 2008 22:36:58 -0700 Subject: [PATCH 03/95] git-gui: Fix gitk search in $PATH to work on Windows Back in 15430be5a1 ("Look for gitk in $PATH, not $LIBEXEC/git-core") git-gui learned to use [_which gitk] to locate where gitk's script is as Git 1.6 will install gitk to $prefix/bin (in $PATH) and all of the other tools are in $gitexecdir. This failed on Windows because _which adds the ".exe" suffix as it searches for the program on $PATH, under the assumption that we can only execute something from Tcl if it is a proper Windows executable. When scanning for gitk on Windows we need to omit the ".exe" suffix. Signed-off-by: Shawn O. Pearce --- git-gui.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/git-gui.sh b/git-gui.sh index ce941adf8d..14b2d9aacd 100755 --- a/git-gui.sh +++ b/git-gui.sh @@ -317,7 +317,7 @@ proc _git_cmd {name} { return $v } -proc _which {what} { +proc _which {what args} { global env _search_exe _search_path if {$_search_path eq {}} { @@ -340,8 +340,14 @@ proc _which {what} { } } + if {[is_Windows] && [lsearch -exact $args -script] >= 0} { + set suffix {} + } else { + set suffix $_search_exe + } + foreach p $_search_path { - set p [file join $p $what$_search_exe] + set p [file join $p $what$suffix] if {[file exists $p]} { return [file normalize $p] } @@ -1686,7 +1692,7 @@ proc do_gitk {revs} { # -- Always start gitk through whatever we were loaded with. This # lets us bypass using shell process on Windows systems. # - set exe [_which gitk] + set exe [_which gitk -script] set cmd [list [info nameofexecutable] $exe] if {$exe eq {}} { error_popup [mc "Couldn't find gitk in PATH"] From f8f1acf339da302ea912c8dd114042a1ef6f994f Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sun, 27 Jul 2008 14:23:30 -0700 Subject: [PATCH 04/95] git-gui: Correct installation of library to be $prefix/share We always wanted the library for git-gui to install into the $prefix/share directory, not $prefix/libexec/share. All of the files in our library are platform independent and may be reused across systems, like any other content stored in the share directory. Our computation of where our library should install to was broken when git itself started installing to $prefix/libexec/git-core, which was one level down from where we expected it to be. Signed-off-by: Steffen Prohaska Signed-off-by: Shawn O. Pearce --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index b19fb2d64e..c9d67fe98e 100644 --- a/Makefile +++ b/Makefile @@ -34,8 +34,12 @@ ifndef gitexecdir endif ifndef sharedir +ifeq (git-core,$(notdir $(gitexecdir))) + sharedir := $(dir $(patsubst %/,%,$(dir $(gitexecdir))))share +else sharedir := $(dir $(gitexecdir))share endif +endif ifndef INSTALL INSTALL = install From f57ddcc5ecf16d1fff4b6e222352c3220fe8120f Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sun, 27 Jul 2008 18:49:42 +0200 Subject: [PATCH 05/95] git-gui (Windows): Switch to relative discovery of oguilib Instead of using an absolute path, git-gui can discover its gui library using a relative path from execdir. We want to use the relative path discovery on MinGW to avoid issues with translation of absolute paths. Signed-off-by: Steffen Prohaska Signed-off-by: Shawn O. Pearce --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index c9d67fe98e..55765c8a3a 100644 --- a/Makefile +++ b/Makefile @@ -160,6 +160,7 @@ endif ifneq (,$(findstring MINGW,$(uname_S))) NO_MSGFMT=1 GITGUI_WINDOWS_WRAPPER := YesPlease + GITGUI_RELATIVE := 1 endif ifdef GITGUI_MACOSXAPP From 5fc6edab76ea16c5fad7138389c2fcc2076534e7 Mon Sep 17 00:00:00 2001 From: Steffen Prohaska Date: Sun, 27 Jul 2008 18:49:43 +0200 Subject: [PATCH 06/95] git-gui (Windows): Change wrapper to execdir 'libexec/git-core' git-gui needs bindir in PATH to be able to run 'git'. bindir however is not necessarily in PATH if started directly through a Windows shortcut. Therefore, we used to add the directory git-gui is located in. But with the new 'libexec/git-core' layout this directory is no longer identical to bindir. This commit modifies the wrapper script to discover the bindir and add it to PATH. Signed-off-by: Steffen Prohaska Signed-off-by: Shawn O. Pearce --- windows/git-gui.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/windows/git-gui.sh b/windows/git-gui.sh index 98f32c0a07..53c3a94686 100644 --- a/windows/git-gui.sh +++ b/windows/git-gui.sh @@ -8,9 +8,12 @@ if { $argc >=2 && [lindex $argv 0] == "--working-dir" } { incr argc -2 } -set gitguidir [file dirname [info script]] -regsub -all ";" $gitguidir "\\;" gitguidir -set env(PATH) "$gitguidir;$env(PATH)" -unset gitguidir +set bindir [file dirname \ + [file dirname \ + [file dirname [info script]]]] +set bindir [file join $bindir bin] +regsub -all ";" $bindir "\\;" bindir +set env(PATH) "$bindir;$env(PATH)" +unset bindir source [file join [file dirname [info script]] git-gui.tcl] From a56bf5850a07e9119cd7e53de1465af432642ef8 Mon Sep 17 00:00:00 2001 From: Abhijit Menon-Sen Date: Wed, 30 Jul 2008 01:23:16 +0530 Subject: [PATCH 07/95] `git submodule add` now requires a Signed-off-by: Abhijit Menon-Sen Signed-off-by: Junio C Hamano --- Documentation/user-manual.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index c5641af190..00256ca57c 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -3458,7 +3458,7 @@ $ cd super $ git init $ for i in a b c d do - git submodule add ~/git/$i + git submodule add ~/git/$i $i done ------------------------------------------------- @@ -3471,10 +3471,10 @@ $ ls -a . .. .git .gitmodules a b c d ------------------------------------------------- -The `git-submodule add` command does a couple of things: +The `git-submodule add ` command does a couple of things: -- It clones the submodule under the current directory and by default checks out - the master branch. +- It clones the submodule from to the given under the + current directory and by default checks out the master branch. - It adds the submodule's clone path to the linkgit:gitmodules[5] file and adds this file to the index, ready to be committed. - It adds the submodule's current commit ID to the index, ready to be From 2c9693bda5f5c726847b4763dd6f82cfdca3e8d7 Mon Sep 17 00:00:00 2001 From: Abhijit Menon-Sen Date: Wed, 30 Jul 2008 04:43:38 +0530 Subject: [PATCH 08/95] Make it clear that push can take multiple refspecs Signed-off-by: Abhijit Menon-Sen Signed-off-by: Junio C Hamano --- Documentation/git-push.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt index 94d07ab812..050c3ddae2 100644 --- a/Documentation/git-push.txt +++ b/Documentation/git-push.txt @@ -10,7 +10,8 @@ SYNOPSIS -------- [verse] 'git push' [--all] [--dry-run] [--tags] [--receive-pack=] - [--repo=all] [-f | --force] [-v | --verbose] [ ...] + [--repo=all] [-f | --force] [-v | --verbose] + [ ...] DESCRIPTION ----------- @@ -29,8 +30,8 @@ OPTIONS The "remote" repository that is destination of a push operation. See the section <> below. -:: - The canonical format of a parameter is +...:: + The canonical format of each parameter is `+?:`; that is, an optional plus `+`, followed by the source ref, followed by a colon `:`, followed by the destination ref. @@ -180,11 +181,11 @@ git push origin :experimental:: Find a ref that matches `experimental` in the `origin` repository (e.g. `refs/heads/experimental`), and delete it. -git push origin master:satellite/master:: - Find a ref that matches `master` in the source repository - (most likely, it would find `refs/heads/master`), and update - the ref that matches `satellite/master` (most likely, it would - be `refs/remotes/satellite/master`) in `origin` repository with it. +git push origin master:satellite/master dev:satellite/dev:: + Use the source ref that matches `master` (e.g. `refs/heads/master`) + to update the ref that matches `satellite/master` (most probably + `refs/remotes/satellite/master`) in the `origin` repository, then + do the same for `dev` and `satellite/dev`. git push origin master:refs/heads/experimental:: Create the branch `experimental` in the `origin` repository From 8cb070a4cfea48f88ada02a87320c3ca63b934cb Mon Sep 17 00:00:00 2001 From: Brian Gernhardt Date: Tue, 29 Jul 2008 21:16:01 -0400 Subject: [PATCH 09/95] Documentation: Remove mentions of git-svnimport. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svnimport is no longer supported, so don't mention it in the documentation. This also updates the description, removing the historical discussion, since it mostly dealt with how it differed from svnimport. The new description gives some starting points into the rest of the documentation. Noticed by Jurko Gospodnetić Signed-off-by: Brian Gernhardt Signed-off-by: Junio C Hamano --- Documentation/git-svn.txt | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt index e7c0f1c959..f230125a81 100644 --- a/Documentation/git-svn.txt +++ b/Documentation/git-svn.txt @@ -12,18 +12,18 @@ SYNOPSIS DESCRIPTION ----------- 'git-svn' is a simple conduit for changesets between Subversion and git. -It is not to be confused with linkgit:git-svnimport[1], which is -read-only. +It provides a bidirectional flow of changes between a Subversion and a git +respository. -'git-svn' was originally designed for an individual developer who wants a -bidirectional flow of changesets between a single branch in Subversion -and an arbitrary number of branches in git. Since its inception, -'git-svn' has gained the ability to track multiple branches in a manner -similar to 'git-svnimport'. +'git-svn' can track a single Subversion branch simply by using a +URL to the branch, follow branches laid out in the Subversion recommended +method (trunk, branches, tags directories) with the --stdlayout option, or +follow branches in any layout with the -T/-t/-b options (see options to +'init' below, and also the 'clone' command). -'git-svn' is especially useful when it comes to tracking repositories -not organized in the way Subversion developers recommend (trunk, -branches, tags directories). +Once tracking a Subversion branch (with any of the above methods), the git +repository can be updated from Subversion by the 'fetch' command and +Subversion updated from git by the 'dcommit' command. COMMANDS -------- @@ -218,8 +218,7 @@ Any other arguments are passed directly to 'git-log' 'commit-diff':: Commits the diff of two tree-ish arguments from the - command-line. This command is intended for interoperability with - 'git-svnimport' and does not rely on being inside an `git-svn + command-line. This command does not rely on being inside an `git-svn init`-ed repository. This command takes three arguments, (a) the original tree to diff against, (b) the new tree result, (c) the URL of the target Subversion repository. The final argument @@ -317,8 +316,7 @@ config key: svn.findcopiesharder -A:: --authors-file=:: -Syntax is compatible with the files used by 'git-svnimport' and -'git-cvsimport': +Syntax is compatible with the file used by 'git-cvsimport': ------------------------------------------------------------------------ loginname = Joe User From 6b2fbaaffc5ec762eae5d23b58b1dc0a88e2275e Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Tue, 29 Jul 2008 22:49:33 -0700 Subject: [PATCH 10/95] format-patch: Produce better output with --inline or --attach This patch makes two small changes to improve the output of --inline and --attach. The first is to write a newline preceding the boundary. This is needed because MIME defines the encapsulation boundary as including the preceding CRLF (or in this case, just LF), so we should be writing one. Without this, the last newline in the pre-diff content is consumed instead. The second change is to always write the line termination character (default: newline) even when using --inline or --attach. This is simply to improve the aesthetics of the resulting message. When using --inline an email client should render the resulting message identically to the non-inline version. And when using --attach this adds a blank line preceding the attachment in the email, which is visually attractive. Signed-off-by: Kevin Ballard Signed-off-by: Junio C Hamano --- diff.c | 3 +-- log-tree.c | 2 +- t/t4013/diff.format-patch_--attach_--stdout_initial..master | 6 ++++++ .../diff.format-patch_--attach_--stdout_initial..master^ | 4 ++++ t/t4013/diff.format-patch_--attach_--stdout_initial..side | 2 ++ ...nline_--stdout_--subject-prefix=TESTCASE_initial..master | 6 ++++++ t/t4013/diff.format-patch_--inline_--stdout_initial..master | 6 ++++++ .../diff.format-patch_--inline_--stdout_initial..master^ | 4 ++++ .../diff.format-patch_--inline_--stdout_initial..master^^ | 2 ++ t/t4013/diff.format-patch_--inline_--stdout_initial..side | 2 ++ 10 files changed, 34 insertions(+), 3 deletions(-) diff --git a/diff.c b/diff.c index a07812c5c7..cbf25473c5 100644 --- a/diff.c +++ b/diff.c @@ -3223,11 +3223,10 @@ void diff_flush(struct diff_options *options) if (output_format & DIFF_FORMAT_PATCH) { if (separator) { + putc(options->line_termination, options->file); if (options->stat_sep) { /* attach patch instead of inline */ fputs(options->stat_sep, options->file); - } else { - putc(options->line_termination, options->file); } } diff --git a/log-tree.c b/log-tree.c index 5505606ed6..bd8b9e45ab 100644 --- a/log-tree.c +++ b/log-tree.c @@ -198,7 +198,7 @@ void log_write_email_headers(struct rev_info *opt, const char *name, extra_headers = subject_buffer; snprintf(buffer, sizeof(buffer) - 1, - "--%s%s\n" + "\n--%s%s\n" "Content-Type: text/x-patch;" " name=\"%s.diff\"\n" "Content-Transfer-Encoding: 8bit\n" diff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..master b/t/t4013/diff.format-patch_--attach_--stdout_initial..master index cf6891f748..43346b9ba4 100644 --- a/t/t4013/diff.format-patch_--attach_--stdout_initial..master +++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master @@ -19,6 +19,8 @@ This is the second commit. file2 | 3 --- 3 files changed, 5 insertions(+), 3 deletions(-) delete mode 100644 file2 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" Content-Transfer-Encoding: 8bit @@ -75,6 +77,8 @@ Content-Transfer-Encoding: 8bit file1 | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 file1 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" Content-Transfer-Encoding: 8bit @@ -122,6 +126,8 @@ Content-Transfer-Encoding: 8bit file3 | 4 ++++ 3 files changed, 9 insertions(+), 0 deletions(-) create mode 100644 file3 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" Content-Transfer-Encoding: 8bit diff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..master^ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master^ index fe0258720c..d7490a9fd7 100644 --- a/t/t4013/diff.format-patch_--attach_--stdout_initial..master^ +++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..master^ @@ -19,6 +19,8 @@ This is the second commit. file2 | 3 --- 3 files changed, 5 insertions(+), 3 deletions(-) delete mode 100644 file2 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" Content-Transfer-Encoding: 8bit @@ -75,6 +77,8 @@ Content-Transfer-Encoding: 8bit file1 | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 file1 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" Content-Transfer-Encoding: 8bit diff --git a/t/t4013/diff.format-patch_--attach_--stdout_initial..side b/t/t4013/diff.format-patch_--attach_--stdout_initial..side index 9ff828ee9d..38f790290a 100644 --- a/t/t4013/diff.format-patch_--attach_--stdout_initial..side +++ b/t/t4013/diff.format-patch_--attach_--stdout_initial..side @@ -17,6 +17,8 @@ Content-Transfer-Encoding: 8bit file3 | 4 ++++ 3 files changed, 9 insertions(+), 0 deletions(-) create mode 100644 file3 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" Content-Transfer-Encoding: 8bit diff --git a/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master b/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master index a8093be7ca..fca5cce373 100644 --- a/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master +++ b/t/t4013/diff.format-patch_--inline_--stdout_--subject-prefix=TESTCASE_initial..master @@ -19,6 +19,8 @@ This is the second commit. file2 | 3 --- 3 files changed, 5 insertions(+), 3 deletions(-) delete mode 100644 file2 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" Content-Transfer-Encoding: 8bit @@ -75,6 +77,8 @@ Content-Transfer-Encoding: 8bit file1 | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 file1 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" Content-Transfer-Encoding: 8bit @@ -122,6 +126,8 @@ Content-Transfer-Encoding: 8bit file3 | 4 ++++ 3 files changed, 9 insertions(+), 0 deletions(-) create mode 100644 file3 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" Content-Transfer-Encoding: 8bit diff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..master b/t/t4013/diff.format-patch_--inline_--stdout_initial..master index aa110c0e7f..6d6fac3908 100644 --- a/t/t4013/diff.format-patch_--inline_--stdout_initial..master +++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master @@ -19,6 +19,8 @@ This is the second commit. file2 | 3 --- 3 files changed, 5 insertions(+), 3 deletions(-) delete mode 100644 file2 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" Content-Transfer-Encoding: 8bit @@ -75,6 +77,8 @@ Content-Transfer-Encoding: 8bit file1 | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 file1 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" Content-Transfer-Encoding: 8bit @@ -122,6 +126,8 @@ Content-Transfer-Encoding: 8bit file3 | 4 ++++ 3 files changed, 9 insertions(+), 0 deletions(-) create mode 100644 file3 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" Content-Transfer-Encoding: 8bit diff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^ index 95e9ea4c59..18a1110def 100644 --- a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^ +++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^ @@ -19,6 +19,8 @@ This is the second commit. file2 | 3 --- 3 files changed, 5 insertions(+), 3 deletions(-) delete mode 100644 file2 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" Content-Transfer-Encoding: 8bit @@ -75,6 +77,8 @@ Content-Transfer-Encoding: 8bit file1 | 3 +++ 2 files changed, 5 insertions(+), 0 deletions(-) create mode 100644 file1 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0.diff" Content-Transfer-Encoding: 8bit diff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^ index b8e81e1552..4f258b8858 100644 --- a/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^ +++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..master^^ @@ -19,6 +19,8 @@ This is the second commit. file2 | 3 --- 3 files changed, 5 insertions(+), 3 deletions(-) delete mode 100644 file2 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44.diff" Content-Transfer-Encoding: 8bit diff --git a/t/t4013/diff.format-patch_--inline_--stdout_initial..side b/t/t4013/diff.format-patch_--inline_--stdout_initial..side index 86ae923d71..e86dce69a3 100644 --- a/t/t4013/diff.format-patch_--inline_--stdout_initial..side +++ b/t/t4013/diff.format-patch_--inline_--stdout_initial..side @@ -17,6 +17,8 @@ Content-Transfer-Encoding: 8bit file3 | 4 ++++ 3 files changed, 9 insertions(+), 0 deletions(-) create mode 100644 file3 + + --------------g-i-t--v-e-r-s-i-o-n Content-Type: text/x-patch; name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff" Content-Transfer-Encoding: 8bit From ae7c5dcef92d46cfc8987fde2c264614fe475bd1 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 27 Jul 2008 00:52:54 +0400 Subject: [PATCH 11/95] Support copy and rename detection in fast-export. Although it does not matter for Git itself, tools that export to systems that explicitly track copies and renames can benefit from such information. This patch makes fast-export output correct action logs when -M or -C are enabled. Signed-off-by: Alexander Gavrilov Signed-off-by: Junio C Hamano --- Documentation/git-fast-export.txt | 9 ++++++ builtin-fast-export.c | 28 +++++++++++++++++-- t/t9301-fast-export.sh | 46 +++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 2 deletions(-) diff --git a/Documentation/git-fast-export.txt b/Documentation/git-fast-export.txt index 4956964d85..b974e2115b 100644 --- a/Documentation/git-fast-export.txt +++ b/Documentation/git-fast-export.txt @@ -36,6 +36,15 @@ when encountering a signed tag. With 'strip', the tags will be made unsigned, with 'verbatim', they will be silently exported and with 'warn', they will be exported, but you will see a warning. +-M:: +-C:: + Perform move and/or copy detection, as described in the + linkgit:git-diff[1] manual page, and use it to generate + rename and copy commands in the output dump. ++ +Note that earlier versions of this command did not complain and +produced incorrect results if you gave these options. + --export-marks=:: Dumps the internal marks table to when complete. Marks are written one per line as `:markid SHA-1`. Only marks diff --git a/builtin-fast-export.c b/builtin-fast-export.c index e508ced6ba..070971616d 100644 --- a/builtin-fast-export.c +++ b/builtin-fast-export.c @@ -132,10 +132,27 @@ static void show_filemodify(struct diff_queue_struct *q, { int i; for (i = 0; i < q->nr; i++) { + struct diff_filespec *ospec = q->queue[i]->one; struct diff_filespec *spec = q->queue[i]->two; - if (is_null_sha1(spec->sha1)) + + switch (q->queue[i]->status) { + case DIFF_STATUS_DELETED: printf("D %s\n", spec->path); - else { + break; + + case DIFF_STATUS_COPIED: + case DIFF_STATUS_RENAMED: + printf("%c \"%s\" \"%s\"\n", q->queue[i]->status, + ospec->path, spec->path); + + if (!hashcmp(ospec->sha1, spec->sha1) && + ospec->mode == spec->mode) + break; + /* fallthrough */ + + case DIFF_STATUS_TYPE_CHANGED: + case DIFF_STATUS_MODIFIED: + case DIFF_STATUS_ADDED: /* * Links refer to objects in another repositories; * output the SHA-1 verbatim. @@ -148,6 +165,13 @@ static void show_filemodify(struct diff_queue_struct *q, printf("M %06o :%d %s\n", spec->mode, get_object_mark(object), spec->path); } + break; + + default: + die("Unexpected comparison status '%c' for %s, %s", + q->queue[i]->status, + ospec->path ? ospec->path : "none", + spec->path ? spec->path : "none"); } } } diff --git a/t/t9301-fast-export.sh b/t/t9301-fast-export.sh index 8324f6e3bd..c19b4a2bab 100755 --- a/t/t9301-fast-export.sh +++ b/t/t9301-fast-export.sh @@ -185,4 +185,50 @@ test_expect_success 'submodule fast-export | fast-import' ' ' +export GIT_AUTHOR_NAME='A U Thor' +export GIT_COMMITTER_NAME='C O Mitter' + +test_expect_success 'setup copies' ' + + git config --unset i18n.commitencoding && + git checkout -b copy rein && + git mv file file3 && + git commit -m move1 && + test_tick && + cp file2 file4 && + git add file4 && + git mv file2 file5 && + git commit -m copy1 && + test_tick && + cp file3 file6 && + git add file6 && + git commit -m copy2 && + test_tick && + echo more text >> file6 && + echo even more text >> file6 && + git add file6 && + git commit -m modify && + test_tick && + cp file6 file7 && + echo test >> file7 && + git add file7 && + git commit -m copy_modify + +' + +test_expect_success 'fast-export -C -C | fast-import' ' + + ENTRY=$(git rev-parse --verify copy) && + rm -rf new && + mkdir new && + git --git-dir=new/.git init && + git fast-export -C -C --signed-tags=strip --all > output && + grep "^C \"file6\" \"file7\"\$" output && + cat output | + (cd new && + git fast-import && + test $ENTRY = $(git rev-parse --verify refs/heads/copy)) + +' + test_done From bd2574ca69331d33429f8806ce189b2941e490e7 Mon Sep 17 00:00:00 2001 From: Anders Melchiorsen Date: Tue, 29 Jul 2008 22:12:22 +0200 Subject: [PATCH 12/95] Advertise the ability to abort a commit This treats aborting a commit more like a feature. Signed-off-by: Anders Melchiorsen Signed-off-by: Junio C Hamano --- builtin-commit.c | 1 + t/t7502-commit.sh | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/builtin-commit.c b/builtin-commit.c index 9a11ca0bcd..f7c053a010 100644 --- a/builtin-commit.c +++ b/builtin-commit.c @@ -555,6 +555,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix) fprintf(fp, "\n" "# Please enter the commit message for your changes.\n" + "# To abort the commit, use an empty commit message.\n" "# (Comment lines starting with '#' will "); if (cleanup_mode == CLEANUP_ALL) fprintf(fp, "not be included)\n"); diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh index 4f2682ea80..f1112639b6 100755 --- a/t/t7502-commit.sh +++ b/t/t7502-commit.sh @@ -142,6 +142,7 @@ test_expect_success 'cleanup commit messages (strip,-F)' ' echo "sample # Please enter the commit message for your changes. +# To abort the commit, use an empty commit message. # (Comment lines starting with '#' will not be included)" >expect test_expect_success 'cleanup commit messages (strip,-F,-e)' ' @@ -149,7 +150,7 @@ test_expect_success 'cleanup commit messages (strip,-F,-e)' ' echo >>negative && { echo;echo sample;echo; } >text && git commit -e -F text -a && - head -n 4 .git/COMMIT_EDITMSG >actual && + head -n 5 .git/COMMIT_EDITMSG >actual && test_cmp expect actual ' @@ -162,7 +163,7 @@ test_expect_success 'author different from committer' ' echo >>negative && git commit -e -m "sample" - head -n 7 .git/COMMIT_EDITMSG >actual && + head -n 8 .git/COMMIT_EDITMSG >actual && test_cmp expect actual ' @@ -181,7 +182,7 @@ test_expect_success 'committer is automatic' ' # must fail because there is no change test_must_fail git commit -e -m "sample" ) && - head -n 8 .git/COMMIT_EDITMSG | \ + head -n 9 .git/COMMIT_EDITMSG | \ sed "s/^# Committer: .*/# Committer:/" >actual && test_cmp expect actual ' From c70115b4b1a8c197b9b829b1fd15d578a3ffcdc3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 29 Jul 2008 01:13:44 -0700 Subject: [PATCH 13/95] Teach gitlinks to ie_modified() and ce_modified_check_fs() The ie_modified() function is the workhorse for refresh_cache_entry(), i.e. checking if an index entry that is stat-dirty actually has changes. After running quicker check to compare cached stat information with results from the latest lstat(2) to answer "has modification" early, the code goes on to check if there really is a change by comparing the staged data with what is on the filesystem by asking ce_modified_check_fs(). However, this function always said "no change" for any gitlinks that has a directory at the corresponding path. This made ie_modified() to miss actual changes in the subproject. The patch fixes this first by modifying an existing short-circuit logic before calling the ce_modified_check_fs() function. It knows that for any filesystem entity to which ie_match_stat() says its data has changed, if its cached size is nonzero then the contents cannot match, which is a correct optimization only for blob objects. We teach gitlink objects to this special case, as we already know that any gitlink that ie_match_stat() says is modified is indeed modified at this point in the codepath. With the above change, we could leave ce_modified_check_fs() broken, but it also futureproofs the code by teaching it to use ce_compare_gitlink(), instead of assuming (incorrectly) that any directory is unchanged. Originally noticed by Alex Riesen on Cygwin. Signed-off-by: Junio C Hamano --- read-cache.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/read-cache.c b/read-cache.c index 1cae361c6c..2c03ec3069 100644 --- a/read-cache.c +++ b/read-cache.c @@ -147,7 +147,7 @@ static int ce_modified_check_fs(struct cache_entry *ce, struct stat *st) break; case S_IFDIR: if (S_ISGITLINK(ce->ce_mode)) - return 0; + return ce_compare_gitlink(ce) ? DATA_CHANGED : 0; default: return TYPE_CHANGED; } @@ -187,6 +187,7 @@ static int ce_match_stat_basic(struct cache_entry *ce, struct stat *st) changed |= TYPE_CHANGED; break; case S_IFGITLINK: + /* We ignore most of the st_xxx fields for gitlinks */ if (!S_ISDIR(st->st_mode)) changed |= TYPE_CHANGED; else if (ce_compare_gitlink(ce)) @@ -293,11 +294,22 @@ int ie_modified(const struct index_state *istate, if (changed & (MODE_CHANGED | TYPE_CHANGED)) return changed; - /* Immediately after read-tree or update-index --cacheinfo, - * the length field is zero. For other cases the ce_size - * should match the SHA1 recorded in the index entry. + /* + * Immediately after read-tree or update-index --cacheinfo, + * the length field is zero, as we have never even read the + * lstat(2) information once, and we cannot trust DATA_CHANGED + * returned by ie_match_stat() which in turn was returned by + * ce_match_stat_basic() to signal that the filesize of the + * blob changed. We have to actually go to the filesystem to + * see if the contents match, and if so, should answer "unchanged". + * + * The logic does not apply to gitlinks, as ce_match_stat_basic() + * already has checked the actual HEAD from the filesystem in the + * subproject. If ie_match_stat() already said it is different, + * then we know it is. */ - if ((changed & DATA_CHANGED) && ce->ce_size != 0) + if ((changed & DATA_CHANGED) && + (S_ISGITLINK(ce->ce_mode) || ce->ce_size != 0)) return changed; changed_fs = ce_modified_check_fs(ce, st); @@ -1326,6 +1338,11 @@ static void ce_smudge_racily_clean_entry(struct cache_entry *ce) * falsely clean entry due to touch-update-touch race, so we leave * everything else as they are. We are called for entries whose * ce_mtime match the index file mtime. + * + * Note that this actually does not do much for gitlinks, for + * which ce_match_stat_basic() always goes to the actual + * contents. The caller checks with is_racy_timestamp() which + * always says "no" for gitlinks, so we are not called for them ;-) */ struct stat st; From 4fac1d3a98bb86d855b706d7ce6a5069b9f687e8 Mon Sep 17 00:00:00 2001 From: Rene Scharfe Date: Fri, 25 Jul 2008 12:41:26 +0200 Subject: [PATCH 14/95] archive: allow --exec and --remote without equal sign Convert git archive to parse_options(). The parameters --remote and --exec are still handled by their special parser. Define them anyway in order for them to show up in the usage notice. Note: in a command like "git archive --prefix --remote=a/ HEAD", the string "--remote=a/" will be interpreted as a remote option, not a prefix, because that special parser sees it first. If one needs such a strange prefix, it needs to be specified like this: "git archive --prefix=--remote=a/ HEAD" (with an equal sign). Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano --- archive.c | 104 ++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 65 insertions(+), 39 deletions(-) diff --git a/archive.c b/archive.c index f834b5f51f..5b40e261f1 100644 --- a/archive.c +++ b/archive.c @@ -3,9 +3,15 @@ #include "tree-walk.h" #include "attr.h" #include "archive.h" +#include "parse-options.h" -static const char archive_usage[] = \ -"git archive --format= [--prefix=/] [--verbose] [] [path...]"; +static char const * const archive_usage[] = { + "git archive [options] [path...]", + "git archive --list", + "git archive --remote [--exec ] [options] [path...]", + "git archive --remote [--exec ] --list", + NULL +}; #define USES_ZLIB_COMPRESSION 1 @@ -175,6 +181,9 @@ static const struct archiver *lookup_archiver(const char *name) { int i; + if (!name) + return NULL; + for (i = 0; i < ARRAY_SIZE(archivers); i++) { if (!strcmp(name, archivers[i].name)) return &archivers[i]; @@ -232,51 +241,70 @@ static void parse_treeish_arg(const char **argv, ar_args->time = archive_time; } +#define OPT__COMPR(s, v, h, p) \ + { OPTION_SET_INT, (s), NULL, (v), NULL, (h), \ + PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, (p) } +#define OPT__COMPR_HIDDEN(s, v, p) \ + { OPTION_SET_INT, (s), NULL, (v), NULL, "", \ + PARSE_OPT_NOARG | PARSE_OPT_NONEG | PARSE_OPT_HIDDEN, NULL, (p) } + static int parse_archive_args(int argc, const char **argv, const struct archiver **ar, struct archiver_args *args) { const char *format = "tar"; - const char *base = ""; + const char *base = NULL; + const char *remote = NULL; + const char *exec = NULL; int compression_level = -1; int verbose = 0; int i; + int list = 0; + struct option opts[] = { + OPT_GROUP(""), + OPT_STRING(0, "format", &format, "fmt", "archive format"), + OPT_STRING(0, "prefix", &base, "prefix", + "prepend prefix to each pathname in the archive"), + OPT__VERBOSE(&verbose), + OPT__COMPR('0', &compression_level, "store only", 0), + OPT__COMPR('1', &compression_level, "compress faster", 1), + OPT__COMPR_HIDDEN('2', &compression_level, 2), + OPT__COMPR_HIDDEN('3', &compression_level, 3), + OPT__COMPR_HIDDEN('4', &compression_level, 4), + OPT__COMPR_HIDDEN('5', &compression_level, 5), + OPT__COMPR_HIDDEN('6', &compression_level, 6), + OPT__COMPR_HIDDEN('7', &compression_level, 7), + OPT__COMPR_HIDDEN('8', &compression_level, 8), + OPT__COMPR('9', &compression_level, "compress better", 9), + OPT_GROUP(""), + OPT_BOOLEAN('l', "list", &list, + "list supported archive formats"), + OPT_GROUP(""), + OPT_STRING(0, "remote", &remote, "repo", + "retrieve the archive from remote repository "), + OPT_STRING(0, "exec", &exec, "cmd", + "path to the remote git-upload-archive command"), + OPT_END() + }; - for (i = 1; i < argc; i++) { - const char *arg = argv[i]; + argc = parse_options(argc, argv, opts, archive_usage, 0); - if (!strcmp(arg, "--list") || !strcmp(arg, "-l")) { - for (i = 0; i < ARRAY_SIZE(archivers); i++) - printf("%s\n", archivers[i].name); - exit(0); - } - if (!strcmp(arg, "--verbose") || !strcmp(arg, "-v")) { - verbose = 1; - continue; - } - if (!prefixcmp(arg, "--format=")) { - format = arg + 9; - continue; - } - if (!prefixcmp(arg, "--prefix=")) { - base = arg + 9; - continue; - } - if (!strcmp(arg, "--")) { - i++; - break; - } - if (arg[0] == '-' && isdigit(arg[1]) && arg[2] == '\0') { - compression_level = arg[1] - '0'; - continue; - } - if (arg[0] == '-') - die("Unknown argument: %s", arg); - break; + if (remote) + die("Unexpected option --remote"); + if (exec) + die("Option --exec can only be used together with --remote"); + + if (!base) + base = ""; + + if (list) { + for (i = 0; i < ARRAY_SIZE(archivers); i++) + printf("%s\n", archivers[i].name); + exit(0); } /* We need at least one parameter -- tree-ish */ - if (argc - 1 < i) - usage(archive_usage); + if (argc < 1) + usage_with_options(archive_usage, opts); *ar = lookup_archiver(format); if (!*ar) die("Unknown archive format '%s'", format); @@ -294,7 +322,7 @@ static int parse_archive_args(int argc, const char **argv, args->base = base; args->baselen = strlen(base); - return i; + return argc; } int write_archive(int argc, const char **argv, const char *prefix, @@ -302,13 +330,11 @@ int write_archive(int argc, const char **argv, const char *prefix, { const struct archiver *ar = NULL; struct archiver_args args; - int tree_idx; - tree_idx = parse_archive_args(argc, argv, &ar, &args); + argc = parse_archive_args(argc, argv, &ar, &args); if (setup_prefix && prefix == NULL) prefix = setup_git_directory(); - argv += tree_idx; parse_treeish_arg(argv, &args, prefix); parse_pathspec_arg(argv + 1, &args); From 81b237d5db946b4196225712a37639952787c959 Mon Sep 17 00:00:00 2001 From: Cesar Eduardo Barros Date: Sat, 26 Jul 2008 21:46:00 -0300 Subject: [PATCH 15/95] Documentation/git-rev-parse.txt: update for new git-describe output format Signed-off-by: Cesar Eduardo Barros Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 5c936693d3..2921da320d 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -155,8 +155,9 @@ blobs contained in a commit. name the same commit object if there are no other object in your repository whose object name starts with dae86e. -* An output from 'git-describe'; i.e. a closest tag, followed by a - dash, a `g`, and an abbreviated object name. +* An output from 'git-describe'; i.e. a closest tag, optionally + followed by a dash and a number of commits, followed by a dash, a + `g`, and an abbreviated object name. * A symbolic ref name. E.g. 'master' typically means the commit object referenced by $GIT_DIR/refs/heads/master. If you From 9b6bf4d575e216db9240907940e9f6c619877735 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 30 Jul 2008 01:12:19 -0700 Subject: [PATCH 16/95] Fix merge name generation in "merge in C" When merging an early part of a branch, e.g. "git merge xyzzy~20", we were supposed to say "branch 'xyzzy' (early part)", but it incorrectly said "branch 'refs/heads/xy' (early part)" instead. The logic was supposed to first strip away "~20" part to make sure that what follows "~" is a non-zero posint, prefix it with "refs/heads/" and ask resolve_ref() if it is a ref. If it is, then we know xyzzy was a branch, and we can give the correct message. However, there were a few bugs. First of all, the logic to build this "true branch refname" did not count the characters correctly. At this point of the code, "len" is the number of trailing, non-name part of the given extended SHA-1 expression given by the user, i.e. number of bytes in "~20" in the above example. In addition, the message forgot to skip "refs/heads/" it prefixed from the output. Signed-off-by: Junio C Hamano --- builtin-merge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/builtin-merge.c b/builtin-merge.c index e78fa18b3a..dde0c7ed33 100644 --- a/builtin-merge.c +++ b/builtin-merge.c @@ -396,12 +396,12 @@ static void merge_name(const char *remote, struct strbuf *msg) struct strbuf truname = STRBUF_INIT; strbuf_addstr(&truname, "refs/heads/"); strbuf_addstr(&truname, remote); - strbuf_setlen(&truname, len+11); + strbuf_setlen(&truname, truname.len - len); if (resolve_ref(truname.buf, buf_sha, 0, 0)) { strbuf_addf(msg, "%s\t\tbranch '%s'%s of .\n", sha1_to_hex(remote_head->sha1), - truname.buf, + truname.buf + 11, (early ? " (early part)" : "")); return; } From 5354a56fe70420c147f930e0f7f1decbae685d19 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Wed, 30 Jul 2008 13:48:33 -0400 Subject: [PATCH 17/95] Replace uses of "git-var" with "git var" Signed-off-by: Todd Zullinger Signed-off-by: Junio C Hamano --- Documentation/git-send-email.txt | 2 +- contrib/examples/git-commit.sh | 6 +++--- contrib/examples/git-tag.sh | 2 +- git-am.sh | 2 +- ident.c | 2 +- perl/Git.pm | 2 +- var.c | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index afbb294a7f..e2437f30ca 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -56,7 +56,7 @@ The --cc option must be repeated for each user you want on the cc list. --from:: Specify the sender of the emails. This will default to - the value GIT_COMMITTER_IDENT, as returned by "git-var -l". + the value GIT_COMMITTER_IDENT, as returned by "git var -l". The user will still be prompted to confirm this entry. --in-reply-to:: diff --git a/contrib/examples/git-commit.sh b/contrib/examples/git-commit.sh index 2c4a4062a5..5c72f655c7 100755 --- a/contrib/examples/git-commit.sh +++ b/contrib/examples/git-commit.sh @@ -443,7 +443,7 @@ fi | git stripspace >"$GIT_DIR"/COMMIT_EDITMSG case "$signoff" in t) - sign=$(git-var GIT_COMMITTER_IDENT | sed -e ' + sign=$(git var GIT_COMMITTER_IDENT | sed -e ' s/>.*/>/ s/^/Signed-off-by: / ') @@ -535,8 +535,8 @@ esac case "$no_edit" in '') - git-var GIT_AUTHOR_IDENT > /dev/null || die - git-var GIT_COMMITTER_IDENT > /dev/null || die + git var GIT_AUTHOR_IDENT > /dev/null || die + git var GIT_COMMITTER_IDENT > /dev/null || die git_editor "$GIT_DIR/COMMIT_EDITMSG" ;; esac diff --git a/contrib/examples/git-tag.sh b/contrib/examples/git-tag.sh index e9f3a228af..2c15bc955b 100755 --- a/contrib/examples/git-tag.sh +++ b/contrib/examples/git-tag.sh @@ -164,7 +164,7 @@ git check-ref-format "tags/$name" || object=$(git rev-parse --verify --default HEAD "$@") || exit 1 type=$(git cat-file -t $object) || exit 1 -tagger=$(git-var GIT_COMMITTER_IDENT) || exit 1 +tagger=$(git var GIT_COMMITTER_IDENT) || exit 1 test -n "$username" || username=$(git config user.signingkey) || diff --git a/git-am.sh b/git-am.sh index 6aa819280e..8f91a97eb3 100755 --- a/git-am.sh +++ b/git-am.sh @@ -291,7 +291,7 @@ fi ws=`cat "$dotest/whitespace"` if test "$(cat "$dotest/sign")" = t then - SIGNOFF=`git-var GIT_COMMITTER_IDENT | sed -e ' + SIGNOFF=`git var GIT_COMMITTER_IDENT | sed -e ' s/>.*/>/ s/^/Signed-off-by: /' ` diff --git a/ident.c b/ident.c index b35504a8d2..09cf0c95c9 100644 --- a/ident.c +++ b/ident.c @@ -204,7 +204,7 @@ const char *fmt_ident(const char *name, const char *email, if ((warn_on_no_name || error_on_no_name) && name == git_default_name && env_hint) { fprintf(stderr, env_hint, au_env, co_env); - env_hint = NULL; /* warn only once, for "git-var -l" */ + env_hint = NULL; /* warn only once, for "git var -l" */ } if (error_on_no_name) die("empty ident %s <%s> not allowed", name, email); diff --git a/perl/Git.pm b/perl/Git.pm index d99e778200..087d3d0e82 100644 --- a/perl/Git.pm +++ b/perl/Git.pm @@ -730,7 +730,7 @@ This suite of functions retrieves and parses ident information, as stored in the commit and tag objects or produced by C (thus C can be either I or I; case is insignificant). -The C method retrieves the ident information from C +The C method retrieves the ident information from C and either returns it as a scalar string or as an array with the fields parsed. Alternatively, it can take a prepared ident string (e.g. from the commit object) and just parse it. diff --git a/var.c b/var.c index 724ba87a7c..f1eb314e89 100644 --- a/var.c +++ b/var.c @@ -5,7 +5,7 @@ */ #include "cache.h" -static const char var_usage[] = "git-var [-l | ]"; +static const char var_usage[] = "git var [-l | ]"; struct git_var { const char *name; From c4aca9ccda51badb672ab70099863072d1567267 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 30 Jul 2008 12:53:45 -0700 Subject: [PATCH 18/95] Fix test-parse-options "integer" test OPT_INTEGER() works on an integer, not on an unsigned long. On a big endian architecture with long larger than int, integer test gives bogus results because of this bug. Reported by H.Merijn Brand in HP-UX 64-bit environment. Signed-off-by: Junio C Hamano --- t/t0040-parse-options.sh | 11 ++++++++++- test-parse-options.c | 8 +++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/t/t0040-parse-options.sh b/t/t0040-parse-options.sh index 03dbe00102..e38241c80a 100755 --- a/t/t0040-parse-options.sh +++ b/t/t0040-parse-options.sh @@ -47,6 +47,7 @@ test_expect_success 'test help' ' cat > expect << EOF boolean: 2 integer: 1729 +timestamp: 0 string: 123 abbrev: 7 verbose: 2 @@ -63,6 +64,7 @@ test_expect_success 'short options' ' cat > expect << EOF boolean: 2 integer: 1729 +timestamp: 0 string: 321 abbrev: 10 verbose: 2 @@ -88,6 +90,7 @@ test_expect_success 'missing required value' ' cat > expect << EOF boolean: 1 integer: 13 +timestamp: 0 string: 123 abbrev: 7 verbose: 0 @@ -108,6 +111,7 @@ test_expect_success 'intermingled arguments' ' cat > expect << EOF boolean: 0 integer: 2 +timestamp: 0 string: (not set) abbrev: 7 verbose: 0 @@ -135,6 +139,7 @@ test_expect_success 'ambiguously abbreviated option' ' cat > expect << EOF boolean: 0 integer: 0 +timestamp: 0 string: 123 abbrev: 7 verbose: 0 @@ -161,6 +166,7 @@ test_expect_success 'detect possible typos' ' cat > expect < expect < expect < expect <"), + OPT_DATE('t', NULL, ×tamp, "get timestamp of