* [PATCH v2 5/6] cvsimport: make tests reusable for cvsimport-3
From: Junio C Hamano @ 2013-01-14 7:25 UTC (permalink / raw)
To: git
In-Reply-To: <1358148351-31552-1-git-send-email-gitster@pobox.com>
This way, a dual-use test can be dot-sourced into a new test script
after defining GIT_CVSPS_VERSION=3 to test that the new cvsimport
with cvsps (3.x) works on simple test histories that old cvsimport
can grok correctly.
Also allow CVSPS2_PATH and CVSPS3_PATH to be defined as "NoThanks"
to cause the tests in t96?? series to be skipped.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
t/lib-cvs.sh | 57 +++++++++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 47 insertions(+), 10 deletions(-)
diff --git a/t/lib-cvs.sh b/t/lib-cvs.sh
index bdab63c..3a55b8a 100644
--- a/t/lib-cvs.sh
+++ b/t/lib-cvs.sh
@@ -1,5 +1,8 @@
#!/bin/sh
+: ${TEST_CVSPS_VERSION=2}
+export TEST_CVSPS_VERSION
+
. ./test-lib.sh
unset CVS_SERVER
@@ -13,22 +16,56 @@ fi
CVS="cvs -f"
export CVS
-CVSPS="$CVSPS2_PATH"
-
-cvsps_version=`$CVSPS -h 2>&1 | sed -ne 's/cvsps version //p'`
-case "$cvsps_version" in
-2.1 | 2.2*)
+skip_all=
+case "$TEST_CVSPS_VERSION" in
+2)
+ if test "$CVSPS2_PATH" = NoThanks
+ then
+ skip_all='skipping cvsimport tests, cvsps(2) not used'
+ else
+ case $($CVSPS2_PATH -h 2>&1 | sed -ne 's/cvsps version //p') in
+ 2.1 | 2.2*)
+ ;;
+ '')
+ skip_all='skipping cvsimport tests, cvsps(2) not found'
+ ;;
+ *)
+ skip_all='skipping cvsimport tests, unsupported cvsps(2)'
+ ;;
+ esac
+ fi
;;
-'')
- skip_all='skipping cvsimport tests, cvsps not found'
- test_done
+3)
+ if test "$CVSPS3_PATH" = NoThanks
+ then
+ skip_all='skipping cvsimport tests, cvsps(3) not used'
+ else
+ case $($CVSPS3_PATH -h 2>&1 | sed -ne 's/cvsps version //p') in
+ 3.*)
+ ;;
+ '')
+ skip_all='skipping cvsimport tests, cvsps(3) not found'
+ ;;
+ *)
+ skip_all='skipping cvsimport tests, unsupported cvsps(3)'
+ ;;
+ esac
+ fi
;;
*)
- skip_all='skipping cvsimport tests, unsupported cvsps version'
- test_done
+ echo >&2 "Bug in test: set TEST_CVSPS_VESION to either 2 or 3"
+ exit 1
;;
esac
+GIT_CVSPS_VERSION=$TEST_CVSPS_VERSION
+export GIT_CVSPS_VERSION
+
+if test -n "$skip_all"
+then
+ test_done
+fi
+
setup_cvs_test_repository () {
CVSROOT="$(pwd)/.cvsroot" &&
cp -r "$TEST_DIRECTORY/$1/cvsroot" "$CVSROOT" &&
--
1.8.1.421.g6236851
^ permalink raw reply related
* [PATCH v2 4/6] cvsimport: start adding cvsps 3.x support
From: Junio C Hamano @ 2013-01-14 7:25 UTC (permalink / raw)
To: git
In-Reply-To: <1358148351-31552-1-git-send-email-gitster@pobox.com>
The new cvsps 3.x series lacks support of some options cvsps 2.x
series had and used by cvsimport-2; add a replacement program from
the author of cvsps 3.x and allow users to choose it by setting the
GIT_CVSPS_VERSION environment variable to 3. We would later add
support to auto-detect the version of installed cvsps to this code
when the environment variable is not set.
Note that in this step, cvsimport-3 that relies on cvsps 3.x does
not have any test coverage. As cvsimport-3 supports most of the
command line options cvsimport-2, we should be able to tweak some of
the t96?? tests and run them with GIT_CVSPS_VERSION set to both 2
and 3, but that is a topic of later patches that should come on top.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
Makefile | 22 +++-
git-cvsimport-3.py | 344 +++++++++++++++++++++++++++++++++++++++++++++++++++++
git-cvsimport.sh | 4 +-
3 files changed, 363 insertions(+), 7 deletions(-)
create mode 100755 git-cvsimport-3.py
diff --git a/Makefile b/Makefile
index f3113a9..00bd3a6 100644
--- a/Makefile
+++ b/Makefile
@@ -256,6 +256,9 @@ all::
# Define CVSPS2_PATH if you cannot invoke cvsps (version 2.x) as "cvsps"
# using your $PATH; if you do not have any, define CVSPS2_PATH=NoThanks.
#
+# Define CVSPS3_PATH if you cannot invoke cvsps (version 3.x) as "cvsps"
+# using your $PATH; if you do not have any, define CVSPS3_PATH=NoThanks.
+#
# Define NO_TCLTK if you do not want Tcl/Tk GUI.
#
# The TCL_PATH variable governs the location of the Tcl interpreter
@@ -480,9 +483,11 @@ SCRIPT_PERL += git-relink.perl
SCRIPT_PERL += git-send-email.perl
SCRIPT_PERL += git-svn.perl
+ifneq ($(CVSPS3_PATH),NoThanks)
+SCRIPT_PYTHON += git-cvsimport-3.py
+endif
SCRIPT_PYTHON += git-p4.py
SCRIPT_PYTHON += git-remote-testpy.py
-SCRIPT_PYTHON += git-p4.py
SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
$(patsubst %.perl,%,$(SCRIPT_PERL)) \
@@ -586,8 +591,11 @@ endif
ifndef CVSPS2_PATH
CVSPS2_PATH = cvsps
endif
+ifndef CVSPS3_PATH
+ CVSPS3_PATH = cvsps
+endif
-export PERL_PATH PYTHON_PATH CVSPS2_PATH
+export PERL_PATH PYTHON_PATH CVSPS2_PATH CVSPS3_PATH
LIB_FILE = libgit.a
XDIFF_LIB = xdiff/lib.a
@@ -1526,6 +1534,7 @@ PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
PYTHON_PATH_SQ = $(subst ','\'',$(PYTHON_PATH))
TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
CVSPS2_PATH_SQ = $(subst ','\'',$(CVSPS2_PATH))
+CVSPS3_PATH_SQ = $(subst ','\'',$(CVSPS3_PATH))
DIFF_SQ = $(subst ','\'',$(DIFF))
LIBS = $(GITLIBS) $(EXTLIBS)
@@ -1768,12 +1777,14 @@ ifndef NO_PYTHON
$(patsubst %.py,%,$(SCRIPT_PYTHON)): GIT-CFLAGS GIT-PREFIX GIT-PYTHON-VARS
$(patsubst %.py,%,$(SCRIPT_PYTHON)): % : %.py
$(QUIET_GEN)$(RM) $@ $@+ && \
- INSTLIBDIR=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \
+ INSTLIBDIR_SQ=`MAKEFLAGS= $(MAKE) -C git_remote_helpers -s \
--no-print-directory prefix='$(prefix_SQ)' DESTDIR='$(DESTDIR_SQ)' \
- instlibdir` && \
+ instlibdir | \
+ sed -e "s/'/'\''/g"` && \
sed -e '1s|#!.*python|#!$(PYTHON_PATH_SQ)|' \
-e 's|\(os\.getenv("GITPYTHONLIB"\)[^)]*)|\1,"@@INSTLIBDIR@@")|' \
- -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
+ -e 's|@@CVSPS3_PATH@@|$(CVSPS3_PATH_SQ)|g' \
+ -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR_SQ"'|g' \
$@.py >$@+ && \
chmod +x $@+ && \
mv $@+ $@
@@ -2119,6 +2130,7 @@ GIT-BUILD-OPTIONS: FORCE
@echo SHELL_PATH=\''$(subst ','\'',$(SHELL_PATH_SQ))'\' >$@
@echo PERL_PATH=\''$(subst ','\'',$(PERL_PATH_SQ))'\' >>$@
@echo CVSPS2_PATH=\''$(subst ','\'',$(CVSPS2_PATH_SQ))'\' >>$@
+ @echo CVSPS3_PATH=\''$(subst ','\'',$(CVSPS3_PATH_SQ))'\' >>$@
@echo DIFF=\''$(subst ','\'',$(subst ','\'',$(DIFF)))'\' >>$@
@echo PYTHON_PATH=\''$(subst ','\'',$(PYTHON_PATH_SQ))'\' >>$@
@echo TAR=\''$(subst ','\'',$(subst ','\'',$(TAR)))'\' >>$@
diff --git a/git-cvsimport-3.py b/git-cvsimport-3.py
new file mode 100755
index 0000000..57f13b7
--- /dev/null
+++ b/git-cvsimport-3.py
@@ -0,0 +1,344 @@
+#!/usr/bin/env python
+#
+# Import CVS history into git
+#
+# Intended to be a near-workalike of Matthias Urlichs's Perl implementation.
+#
+# By Eric S. Raymond <esr@thyrsus.com>, December 2012
+# May be redistributed under the license of the git project.
+
+import sys
+
+if sys.hexversion < 0x02060000:
+ sys.stderr.write("git cvsimport: requires Python 2.6 or later.\n")
+ sys.exit(1)
+
+import os, getopt, subprocess, tempfile, shutil
+
+DEBUG_COMMANDS = 1
+
+class Fatal(Exception):
+ "Unrecoverable error."
+ def __init__(self, msg):
+ Exception.__init__(self)
+ self.msg = msg
+
+def do_or_die(dcmd, legend=""):
+ "Either execute a command or raise a fatal exception."
+ if legend:
+ legend = " " + legend
+ if verbose >= DEBUG_COMMANDS:
+ sys.stdout.write("git cvsimport: executing '%s'%s\n" % (dcmd, legend))
+ try:
+ retcode = subprocess.call(dcmd, shell=True)
+ if retcode < 0:
+ raise Fatal("git cvsimport: child was terminated by signal %d." % -retcode)
+ elif retcode != 0:
+ raise Fatal("git cvsimport: child returned %d." % retcode)
+ except (OSError, IOError) as e:
+ raise Fatal("git cvsimport: execution of %s%s failed: %s" % (dcmd, legend, e))
+
+def capture_or_die(dcmd, legend=""):
+ "Either execute a command and capture its output or die."
+ if legend:
+ legend = " " + legend
+ if verbose >= DEBUG_COMMANDS:
+ sys.stdout.write("git cvsimport: executing '%s'%s\n" % (dcmd, legend))
+ try:
+ return subprocess.check_output(dcmd, shell=True)
+ except subprocess.CalledProcessError as e:
+ if e.returncode < 0:
+ sys.stderr.write("git cvsimport: child was terminated by signal %d." % -e.returncode)
+ elif e.returncode != 0:
+ sys.stderr.write("git cvsimport: child returned %d." % e.returncode)
+ sys.exit(1)
+
+class cvsps:
+ "Method class for cvsps back end."
+
+ cvsps = "@@CVSPS3_PATH@@"
+ def __init__(self):
+ self.opts = ""
+ self.revmap = None
+ def set_repo(self, val):
+ "Set the repository root option."
+ if not val.startswith(":"):
+ if not val.startswith(os.sep):
+ val = os.path.abspath(val)
+ val = ":local:" + val
+ self.opts += " --root '%s'" % val
+ def set_authormap(self, val):
+ "Set the author-map file."
+ self.opts += " -A '%s'" % val
+ def set_fuzz(self, val):
+ "Set the commit-similarity window."
+ self.opts += " -z %s" % val
+ def set_nokeywords(self):
+ "Suppress CVS keyword expansion."
+ self.opts += " -k"
+ def add_opts(self, val):
+ "Add options to the engine command line."
+ self.opts += " " + val
+ def set_exclusion(self, val):
+ "Set a file exclusion regexp."
+ self.opts += " -n -f '%s'" % val
+ def set_after(self, val):
+ "Set a date threshold for incremental import."
+ self.opts += " -d '%s'" % val
+ def set_revmap(self, val):
+ "Set the file to which the engine should dump a reference map."
+ self.revmap = val
+ self.opts += " -R '%s'" % self.revmap
+ def set_module(self, val):
+ "Set the module to query."
+ self.opts += " " + val
+ def command(self):
+ "Emit the command implied by all previous options."
+ return self.cvsps + "--fast-export " + self.opts
+
+class cvs2git:
+ "Method class for cvs2git back end."
+ def __init__(self):
+ self.opts = ""
+ self.modulepath = "."
+ def set_authormap(self, _val):
+ "Set the author-map file."
+ sys.stderr.write("git cvsimport: author maping is not supported with cvs2git.\n")
+ sys.exit(1)
+ def set_repo(self, _val):
+ "Set the repository root option."
+ sys.stderr.write("git cvsimport: cvs2git must run within a repository checkout directory.\n")
+ sys.exit(1)
+ def set_fuzz(self, _val):
+ "Set the commit-similarity window."
+ sys.stderr.write("git cvsimport: fuzz setting is not supported with cvs2git.\n")
+ sys.exit(1)
+ def set_nokeywords(self):
+ "Suppress CVS keyword expansion."
+ self.opts += " --keywords-off"
+ def add_opts(self, val):
+ "Add options to the engine command line."
+ self.opts += " " + val
+ def set_exclusion(self, val):
+ "Set a file exclusion regexp."
+ self.opts += " --exclude='%s'" % val
+ def set_after(self, _val):
+ "Set a date threshold for incremental import."
+ sys.stderr.write("git cvsimport: incremental import is not supported with cvs2git.\n")
+ sys.exit(1)
+ def set_revmap(self, _val):
+ "Set the file to which the engine should dump a reference map."
+ sys.stderr.write("git cvsimport: can't get a reference map from cvs2git.\n")
+ sys.exit(1)
+ def set_module(self, val):
+ "Set the module to query."
+ self.modulepath = " " + val
+ def command(self):
+ "Emit the command implied by all previous options."
+ return "(cvs2git --username=git-cvsimport --quiet --quiet --blobfile={0} --dumpfile={1} {2} {3} && cat {0} {1} && rm {0} {1})".format(tempfile.mkstemp()[1], tempfile.mkstemp()[1], self.opts, self.modulepath)
+
+class filesource:
+ "Method class for file-source back end."
+ def __init__(self, filename):
+ self.filename = filename
+ def __complain(self, legend):
+ sys.stderr.write("git cvsimport: %s with file source.\n" % legend)
+ sys.exit(1)
+ def set_repo(self, _val):
+ "Set the repository root option."
+ self.__complain("repository can't be set")
+ def set_authormap(self, _val):
+ "Set the author-map file."
+ sys.stderr.write("git cvsimport: author mapping is not supported with filesource.\n")
+ sys.exit(1)
+ def set_fuzz(self, _val):
+ "Set the commit-similarity window."
+ self.__complain("fuzz can't be set")
+ def set_nokeywords(self, _val):
+ "Suppress CVS keyword expansion."
+ self.__complain("keyword suppression can't be set")
+ def add_opts(self, _val):
+ "Add options to the engine command line."
+ self.__complain("other options can't be set")
+ def set_exclusion(self, _val):
+ "Set a file exclusion regexp."
+ self.__complain("exclusions can't be set")
+ def set_after(self, _val):
+ "Set a date threshold for incremental import."
+ pass
+ def set_revmap(self, _val):
+ "Set the file to which the engine should dump a reference map."
+ sys.stderr.write("git cvsimport: can't get a reference map from cvs2git.\n")
+ sys.exit(1)
+ def set_module(self, _val):
+ "Set the module to query."
+ self.__complain("module can't be set")
+ def command(self):
+ "Emit the command implied by all previous options."
+ return "cat " + self.filename
+
+if __name__ == '__main__':
+ if sys.hexversion < 0x02060000:
+ sys.stderr.write("git cvsimport: requires Python 2.6 or later.\n")
+ sys.exit(1)
+ (options, arguments) = getopt.getopt(sys.argv[1:], "vbe:d:C:r:o:ikus:p:z:P:S:aL:A:Rh")
+ verbose = 0
+ bare = False
+ root = None
+ outdir = os.getcwd()
+ remotize = False
+ import_only = False
+ underscore_to_dot = False
+ slashsubst = None
+ authormap = None
+ revisionmap = False
+ backend = cvsps()
+ for (opt, val) in options:
+ if opt == '-v':
+ verbose += 1
+ elif opt == '-b':
+ bare = True
+ elif opt == '-e':
+ for cls in (cvsps, cvs2git):
+ if cls.__name__ == val:
+ backend = cls()
+ break
+ else:
+ sys.stderr.write("git cvsimport: unknown engine %s.\n" % val)
+ sys.exit(1)
+ elif opt == '-d':
+ backend.set_repo(val)
+ elif opt == '-C':
+ outdir = val
+ elif opt == '-r':
+ remotize = True
+ elif opt == '-o':
+ sys.stderr.write("git cvsimport: -o is no longer supported.\n")
+ sys.exit(1)
+ elif opt == '-i':
+ import_only = True
+ elif opt == '-k':
+ backend.set_nokeywords()
+ elif opt == '-u':
+ underscore_to_dot = True
+ elif opt == '-s':
+ slashsubst = val
+ elif opt == '-p':
+ backend.add_opts(val.replace(",", " "))
+ elif opt == '-z':
+ backend.set_fuzz(val)
+ elif opt == '-P':
+ backend = filesource(val)
+ sys.exit(1)
+ elif opt in ('-m', '-M'):
+ sys.stderr.write("git cvsimport: -m and -M are no longer supported: use reposurgeon instead.\n")
+ sys.exit(1)
+ elif opt == '-S':
+ backend.set_exclusion(val)
+ elif opt == '-a':
+ sys.stderr.write("git cvsimport: -a is no longer supported.\n")
+ sys.exit(1)
+ elif opt == '-L':
+ sys.stderr.write("git cvsimport: -L is no longer supported.\n")
+ sys.exit(1)
+ elif opt == '-A':
+ authormap = os.path.abspath(val)
+ elif opt == '-R':
+ revisionmap = True
+ else:
+ print """\
+git cvsimport [-A <author-conv-file>] [-C <git_repository>] [-b] [-d <CVSROOT>]
+ [-e engine] [-h] [-i] [-k] [-p <options-for-cvsps>] [-P <source-file>]
+ [-r <remote>] [-R] [-s <subst>] [-S <regex>] [-u] [-v] [-z <fuzz>]
+ [<CVS_module>]
+"""
+ def metadata(fn, outdir='.'):
+ if bare:
+ return os.path.join(outdir, fn)
+ else:
+ return os.path.join(outdir, ".git", fn)
+
+ try:
+ if outdir:
+ try:
+ # If the output directory does not exist, create it
+ # and initialize it as a git repository.
+ os.mkdir(outdir)
+ do_or_die("git init --quiet " + outdir)
+ except OSError:
+ # Otherwise, assume user wants incremental import.
+ if not bare and not os.path.exists(os.path.join(outdir, ".git")):
+ raise Fatal("output directory is not a git repository")
+ threshold = capture_or_die("git log -1 --format=%ct").strip()
+ backend.set_after(threshold)
+ if revisionmap:
+ backend.set_revmap(tempfile.mkstemp()[1])
+ markmap = tempfile.mkstemp()[1]
+ if arguments:
+ backend.set_module(arguments[0])
+ gitopts = ""
+ if bare:
+ gitopts += " --bare"
+ if revisionmap:
+ gitopts += " --export-marks='%s'" % markmap
+ if authormap:
+ shutil.copyfile(authormap, metadata("cvs-authors", outdir))
+ if os.path.exists(metadata("cvs-authors", outdir)):
+ backend.set_authormap(metadata("cvs-authors", outdir))
+ do_or_die("%s | (cd %s >/dev/null; git fast-import --quiet %s)" \
+ % (backend.command(), outdir, gitopts))
+ os.chdir(outdir)
+ if underscore_to_dot or slashsubst:
+ tagnames = capture_or_die("git tag -l")
+ for tag in tagnames.split():
+ if tag:
+ changed = tag
+ if underscore_to_dot:
+ changed = changed.replace("_", ".")
+ if slashsubst:
+ changed = changed.replace(os.sep, slashsubst)
+ if changed != tag:
+ do_or_die("git tag -f %s %s >/dev/null" % (tag, changed))
+ if underscore_to_dot or slashsubst or remotize:
+ branchnames = capture_or_die("git branch -l")
+ for branch in branchnames.split():
+ if branch:
+ # Ugh - fragile dependency on branch -l output format
+ branch = branch[2:]
+ changed = branch
+ if underscore_to_dot:
+ changed = changed.replace("_", ".")
+ if slashsubst:
+ changed = changed.replace(os.sep, slashsubst)
+ if remotize:
+ changed = os.path.join("remotes", remotize, branch)
+ if changed != branch:
+ do_or_die("branch --m %s %s >/dev/null" % (branch, changed))
+ if revisionmap:
+ refd = {}
+ for line in open(backend.revmap):
+ if line.startswith("#"):
+ continue
+ (fn, rev, mark) = line.split()
+ refd[(fn, rev)] = mark
+ markd = {}
+ for line in open(markmap):
+ if line.startswith("#"):
+ continue
+ (mark, hashd) = line.split()
+ markd[mark] = hashd
+ with open(metadata("cvs-revisions"), "a") as wfp:
+ for ((fn, rev), val) in refd.items():
+ if val in markd:
+ wfp.write("%s %s %s\n" % (fn, rev, markd[val]))
+ os.remove(markmap)
+ os.remove(backend.revmap)
+ if not import_only and not bare:
+ do_or_die("git checkout -q")
+ except Fatal, err:
+ sys.stderr.write("git_cvsimport: " + err.msg + "\n")
+ sys.exit(1)
+ except KeyboardInterrupt:
+ pass
+
+# end
diff --git a/git-cvsimport.sh b/git-cvsimport.sh
index 71ba11d..52ce112 100755
--- a/git-cvsimport.sh
+++ b/git-cvsimport.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-GIT_CVSPS_VERSION=2
+: ${GIT_CVSPS_VERSION=2}
-exec git cvsimport-$GIT_CVSPS_VERSION "$@"
+exec git "cvsimport-$GIT_CVSPS_VERSION" "$@"
--
1.8.1.421.g6236851
^ permalink raw reply related
* [PATCH v2 6/6] cvsimport-3: add a sample test
From: Junio C Hamano @ 2013-01-14 7:25 UTC (permalink / raw)
To: git
In-Reply-To: <1358148351-31552-1-git-send-email-gitster@pobox.com>
This is primarily for illustration to show how the support
introduced by the previous step can be used.
Some parts of t9600 needs to be made conditional to the value of
TEST_CVSPS_VERSION to avoid passing options the new cvsimport does
not need or understand, before this can become usable as a real
test.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
t/t9650-cvsimport3.sh | 4 ++++
1 file changed, 4 insertions(+)
create mode 100755 t/t9650-cvsimport3.sh
diff --git a/t/t9650-cvsimport3.sh b/t/t9650-cvsimport3.sh
new file mode 100755
index 0000000..f7ca986
--- /dev/null
+++ b/t/t9650-cvsimport3.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+TEST_CVSPS_VERSION=3
+. ./t9600-cvsimport.sh
--
1.8.1.421.g6236851
^ permalink raw reply related
* [PATCH v2 3/6] cvsimport: introduce a version-switch wrapper
From: Junio C Hamano @ 2013-01-14 7:25 UTC (permalink / raw)
To: git
In-Reply-To: <1358148351-31552-1-git-send-email-gitster@pobox.com>
In preparation to have both old and new cvsimport during the
transition period, rename the cvsimport script to cvsimport-2
and introduce a small wrapper that we can later change it to
allow users to run either frontend (with their corresponding
cvsps backends).
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
.gitignore | 1 +
Makefile | 9 ++++++++-
git-cvsimport.perl => git-cvsimport-2.perl | 0
git-cvsimport.sh | 5 +++++
4 files changed, 14 insertions(+), 1 deletion(-)
rename git-cvsimport.perl => git-cvsimport-2.perl (100%)
create mode 100755 git-cvsimport.sh
diff --git a/.gitignore b/.gitignore
index aa258a6..8cb799c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -40,6 +40,7 @@
/git-credential-store
/git-cvsexportcommit
/git-cvsimport
+/git-cvsimport-2
/git-cvsserver
/git-daemon
/git-diff
diff --git a/Makefile b/Makefile
index dd2a024..f3113a9 100644
--- a/Makefile
+++ b/Makefile
@@ -253,6 +253,9 @@ all::
#
# Define NO_PYTHON if you do not want Python scripts or libraries at all.
#
+# Define CVSPS2_PATH if you cannot invoke cvsps (version 2.x) as "cvsps"
+# using your $PATH; if you do not have any, define CVSPS2_PATH=NoThanks.
+#
# Define NO_TCLTK if you do not want Tcl/Tk GUI.
#
# The TCL_PATH variable governs the location of the Tcl interpreter
@@ -440,6 +443,7 @@ unexport CDPATH
SCRIPT_SH += git-am.sh
SCRIPT_SH += git-bisect.sh
+SCRIPT_SH += git-cvsimport.sh
SCRIPT_SH += git-difftool--helper.sh
SCRIPT_SH += git-filter-branch.sh
SCRIPT_SH += git-lost-found.sh
@@ -468,12 +472,15 @@ SCRIPT_PERL += git-add--interactive.perl
SCRIPT_PERL += git-difftool.perl
SCRIPT_PERL += git-archimport.perl
SCRIPT_PERL += git-cvsexportcommit.perl
-SCRIPT_PERL += git-cvsimport.perl
+ifneq ($(CVSPS2_PATH),NoThanks)
+SCRIPT_PERL += git-cvsimport-2.perl
+endif
SCRIPT_PERL += git-cvsserver.perl
SCRIPT_PERL += git-relink.perl
SCRIPT_PERL += git-send-email.perl
SCRIPT_PERL += git-svn.perl
+SCRIPT_PYTHON += git-p4.py
SCRIPT_PYTHON += git-remote-testpy.py
SCRIPT_PYTHON += git-p4.py
diff --git a/git-cvsimport.perl b/git-cvsimport-2.perl
similarity index 100%
rename from git-cvsimport.perl
rename to git-cvsimport-2.perl
diff --git a/git-cvsimport.sh b/git-cvsimport.sh
new file mode 100755
index 0000000..71ba11d
--- /dev/null
+++ b/git-cvsimport.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+GIT_CVSPS_VERSION=2
+
+exec git cvsimport-$GIT_CVSPS_VERSION "$@"
--
1.8.1.421.g6236851
^ permalink raw reply related
* Re: [PATCH v2 0/6] A smoother transition plan for cvsimport
From: Jonathan Nieder @ 2013-01-14 7:47 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <1358148351-31552-1-git-send-email-gitster@pobox.com>
Junio C Hamano wrote:
> Junio C Hamano (6):
> Makefile: add description on PERL/PYTHON_PATH
> cvsimport: allow setting a custom cvsps (2.x) program name
> cvsimport: introduce a version-switch wrapper
> cvsimport: start adding cvsps 3.x support
> cvsimport: make tests reusable for cvsimport-3
> cvsimport-3: add a sample test
Looks very sane.
^ permalink raw reply
* [PATCH v2 7/6] t9600: further prepare for sharing
From: Junio C Hamano @ 2013-01-14 7:48 UTC (permalink / raw)
To: git
In-Reply-To: <1358148351-31552-1-git-send-email-gitster@pobox.com>
When t9650, which dot-sources this script, really becomes ready to
test the new cvsimport, we no longer depend on having PERL to run
this test through it. Move the PERL dependency to lib-cvs.sh
instead.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
t/lib-cvs.sh | 7 +++++++
t/t9600-cvsimport.sh | 30 +++++++++++++++---------------
2 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/t/lib-cvs.sh b/t/lib-cvs.sh
index 3a55b8a..d2bf5bf 100644
--- a/t/lib-cvs.sh
+++ b/t/lib-cvs.sh
@@ -22,6 +22,9 @@ case "$TEST_CVSPS_VERSION" in
if test "$CVSPS2_PATH" = NoThanks
then
skip_all='skipping cvsimport tests, cvsps(2) not used'
+ elif ! test_have_prereq PERL
+ then
+ skip_all='skipping cvsimport tests, Perl not available'
else
case $($CVSPS2_PATH -h 2>&1 | sed -ne 's/cvsps version //p') in
2.1 | 2.2*)
@@ -39,6 +42,10 @@ case "$TEST_CVSPS_VERSION" in
if test "$CVSPS3_PATH" = NoThanks
then
skip_all='skipping cvsimport tests, cvsps(3) not used'
+ elif ! test_have_prereq PYTHON
+ then
+ # NEEDSWORK: we may need Python lower-bound prerequisite
+ skip_all='skipping cvsimport tests, Python not available'
else
case $($CVSPS3_PATH -h 2>&1 | sed -ne 's/cvsps version //p') in
3.*)
diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh
index 4c384ff..906cbdc 100755
--- a/t/t9600-cvsimport.sh
+++ b/t/t9600-cvsimport.sh
@@ -3,14 +3,14 @@
test_description='git cvsimport basic tests'
. ./lib-cvs.sh
-test_expect_success PERL 'setup cvsroot environment' '
+test_expect_success 'setup cvsroot environment' '
CVSROOT=$(pwd)/cvsroot &&
export CVSROOT
'
-test_expect_success PERL 'setup cvsroot' '$CVS init'
+test_expect_success 'setup cvsroot' '$CVS init'
-test_expect_success PERL 'setup a cvs module' '
+test_expect_success 'setup a cvs module' '
mkdir "$CVSROOT/module" &&
$CVS co -d module-cvs module &&
@@ -42,23 +42,23 @@ EOF
)
'
-test_expect_success PERL 'import a trivial module' '
+test_expect_success 'import a trivial module' '
git cvsimport -a -R -z 0 -C module-git module &&
test_cmp module-cvs/o_fortuna module-git/o_fortuna
'
-test_expect_success PERL 'pack refs' '(cd module-git && git gc)'
+test_expect_success 'pack refs' '(cd module-git && git gc)'
-test_expect_success PERL 'initial import has correct .git/cvs-revisions' '
+test_expect_success 'initial import has correct .git/cvs-revisions' '
(cd module-git &&
git log --format="o_fortuna 1.1 %H" -1) > expected &&
test_cmp expected module-git/.git/cvs-revisions
'
-test_expect_success PERL 'update cvs module' '
+test_expect_success 'update cvs module' '
(cd module-cvs &&
cat <<EOF >o_fortuna &&
O Fortune,
@@ -86,7 +86,7 @@ EOF
)
'
-test_expect_success PERL 'update git module' '
+test_expect_success 'update git module' '
(cd module-git &&
git config cvsimport.trackRevisions true &&
@@ -97,7 +97,7 @@ test_expect_success PERL 'update git module' '
'
-test_expect_success PERL 'update has correct .git/cvs-revisions' '
+test_expect_success 'update has correct .git/cvs-revisions' '
(cd module-git &&
git log --format="o_fortuna 1.1 %H" -1 HEAD^ &&
@@ -105,7 +105,7 @@ test_expect_success PERL 'update has correct .git/cvs-revisions' '
test_cmp expected module-git/.git/cvs-revisions
'
-test_expect_success PERL 'update cvs module' '
+test_expect_success 'update cvs module' '
(cd module-cvs &&
echo 1 >tick &&
@@ -114,7 +114,7 @@ test_expect_success PERL 'update cvs module' '
)
'
-test_expect_success PERL 'cvsimport.module config works' '
+test_expect_success 'cvsimport.module config works' '
(cd module-git &&
git config cvsimport.module module &&
@@ -126,7 +126,7 @@ test_expect_success PERL 'cvsimport.module config works' '
'
-test_expect_success PERL 'second update has correct .git/cvs-revisions' '
+test_expect_success 'second update has correct .git/cvs-revisions' '
(cd module-git &&
git log --format="o_fortuna 1.1 %H" -1 HEAD^^ &&
@@ -135,7 +135,7 @@ test_expect_success PERL 'second update has correct .git/cvs-revisions' '
test_cmp expected module-git/.git/cvs-revisions
'
-test_expect_success PERL 'import from a CVS working tree' '
+test_expect_success 'import from a CVS working tree' '
$CVS co -d import-from-wt module &&
(cd import-from-wt &&
@@ -148,12 +148,12 @@ test_expect_success PERL 'import from a CVS working tree' '
'
-test_expect_success PERL 'no .git/cvs-revisions created by default' '
+test_expect_success 'no .git/cvs-revisions created by default' '
! test -e import-from-wt/.git/cvs-revisions
'
-test_expect_success PERL 'test entire HEAD' 'test_cmp_branch_tree master'
+test_expect_success 'test entire HEAD' 'test_cmp_branch_tree master'
test_done
--
1.8.1.421.g6236851
^ permalink raw reply related
* [PATCH v2 8/6] t9600: adjust for new cvsimport
From: Junio C Hamano @ 2013-01-14 7:52 UTC (permalink / raw)
To: git
In-Reply-To: <1358148351-31552-1-git-send-email-gitster@pobox.com>
The rewritten cvsimport does not skip the latest 10 minutes worth of
CVS commits by default, so there is no need to pass the "-a" option;
it will barf if it sees "-a".
Also it will do the merge itself, so there is no need to merge
"origin" ourselves, either.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
* This is still untested and primarily to illustrate the concept
introduced by the 5/6 patch, together with 6/6. Testing by
interested parties with a working cvsps 3 may be nice. Something
like:
$ make CVSPS3_PATH=/path/to/your/cvsps3/bin/cvsps
$ cd t && sh t9650-cvsimport3.sh
t/t9600-cvsimport.sh | 24 +++++++++++++++++-------
1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh
index 906cbdc..7b5a9a0 100755
--- a/t/t9600-cvsimport.sh
+++ b/t/t9600-cvsimport.sh
@@ -42,9 +42,13 @@ EOF
)
'
-test_expect_success 'import a trivial module' '
+case "$TEST_CVSPS_VERSION" in
+3) import_all= ;;
+*) import_all=-a ;;
+esac &&
- git cvsimport -a -R -z 0 -C module-git module &&
+test_expect_success 'import a trivial module' '
+ git cvsimport $import_all -R -z 0 -C module-git module &&
test_cmp module-cvs/o_fortuna module-git/o_fortuna
'
@@ -90,8 +94,11 @@ test_expect_success 'update git module' '
(cd module-git &&
git config cvsimport.trackRevisions true &&
- git cvsimport -a -z 0 module &&
- git merge origin
+ git cvsimport $import_all -z 0 module &&
+ if test "$TEST_CVSPS_VERSION" = 2
+ then
+ git merge origin
+ fi
) &&
test_cmp module-cvs/o_fortuna module-git/o_fortuna
@@ -119,8 +126,11 @@ test_expect_success 'cvsimport.module config works' '
(cd module-git &&
git config cvsimport.module module &&
git config cvsimport.trackRevisions true &&
- git cvsimport -a -z0 &&
- git merge origin
+ git cvsimport $import_all -z0 &&
+ if test "$TEST_CVSPS_VERSION" = 2
+ then
+ git merge origin
+ fi
) &&
test_cmp module-cvs/tick module-git/tick
@@ -140,7 +150,7 @@ test_expect_success 'import from a CVS working tree' '
$CVS co -d import-from-wt module &&
(cd import-from-wt &&
git config cvsimport.trackRevisions false &&
- git cvsimport -a -z0 &&
+ git cvsimport $import_all -z0 &&
echo 1 >expect &&
git log -1 --pretty=format:%s%n >actual &&
test_cmp actual expect
--
1.8.1.421.g6236851
^ permalink raw reply related
* Re: Announcing git-reparent
From: Piotr Krukowiecki @ 2013-01-14 8:03 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Mark Lodato, git list
In-Reply-To: <20130114071608.GL3125@elie.Belkin>
Hello,
On Mon, Jan 14, 2013 at 8:16 AM, Jonathan Nieder <jrnieder@gmail.com> wrote:
> Hi Mark,
>
> Mark Lodato wrote:
>
>> Create a new commit object that has the same tree and commit message as HEAD
>> but with a different set of parents. If ``--no-reset`` is given, the full
>> object id of this commit is printed and the program exits
>
> I've been wishing for something like this for a long time. I used to
> fake it using "cat-file commit", sed, and "hash-object -w" when
> stitching together poorly imported history using "git replace".
Just wondering, is the result different than something like
git checkout commit_to_reparent
cp -r * ../snapshot/
git reset --hard new_parent
rm -r *
cp -r ../snapshot/* .
git add -A
(assumes 1 parent, does not cope with .dot files, and has probably
other small problems)
--
Piotr Krukowiecki
^ permalink raw reply
* Re: Announcing git-reparent
From: Junio C Hamano @ 2013-01-14 8:05 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Mark Lodato, git list
In-Reply-To: <20130114071608.GL3125@elie.Belkin>
Jonathan Nieder <jrnieder@gmail.com> writes:
> Hi Mark,
>
> Mark Lodato wrote:
>
>> Create a new commit object that has the same tree and commit message as HEAD
>> but with a different set of parents. If ``--no-reset`` is given, the full
>> object id of this commit is printed and the program exits
>
> I've been wishing for something like this for a long time. I used to
> fake it using "cat-file commit", sed, and "hash-object -w" when
> stitching together poorly imported history using "git replace".
>
> Thanks for writing it.
>
> Ciao,
> Jonathan
The scriptq is simple enough, and from a cursory look, it may be
fine to throw it in contrib/ after some minor style fixes and such,
if many find it useful.
^ permalink raw reply
* Re: [PATCH] archive-tar: fix sanity check in config parsing
From: Joachim Schmitz @ 2013-01-14 8:17 UTC (permalink / raw)
To: git
In-Reply-To: <20130113200044.GA3979@sigill.intra.peff.net>
Jeff King wrote:
> On Sun, Jan 13, 2013 at 06:42:01PM +0100, René Scharfe wrote:
>
>> When parsing these config variable names, we currently check that
>> the second dot is found nine characters into the name, disallowing
>> filter names with a length of five characters. Additionally,
>> git archive crashes when the second dot is omitted:
>>
>> $ ./git -c tar.foo=bar archive HEAD >/dev/null
>> fatal: Data too large to fit into virtual memory space.
>>
>> Instead we should check if the second dot exists at all, or if
>> we only found the first one.
>
> Eek. Thanks for finding it. Your fix is obviously correct.
>
>> --- a/archive-tar.c
>> +++ b/archive-tar.c
>> @@ -335,7 +335,7 @@ static int tar_filter_config(const char *var,
>> const char *value, void *data) if (prefixcmp(var, "tar."))
>> return 0;
>> dot = strrchr(var, '.');
>> - if (dot == var + 9)
>> + if (dot == var + 3)
>> return 0;
>
> For the curious, the original version of the patch[1] read:
>
> + if (prefixcmp(var, "tarfilter."))
> + return 0;
> + dot = strrchr(var, '.');
> + if (dot == var + 9)
> + return 0;
>
> and when I shortened the config section to "tar" in a re-roll of the
> series, I missed the corresponding change to the offset.
Wouldn't it then be better ti use strlen("tar") rather than a 3? Or at least
a comment?
Bye, Jojo
^ permalink raw reply
* Re: [PATCH 01/14] imap-send.c: remove msg_data::flags, which was always zero
From: Michael Haggerty @ 2013-01-14 9:10 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Junio C Hamano, Jeff King, git
In-Reply-To: <20130114055721.GD3125@elie.Belkin>
On 01/14/2013 06:57 AM, Jonathan Nieder wrote:
> Michael Haggerty wrote:
>
>> This removes the need for function imap_make_flags(), so delete it,
>> too.
> [...]
>> --- a/imap-send.c
>> +++ b/imap-send.c
> [...]
>> box = gctx->name;
>> prefix = !strcmp(box, "INBOX") ? "" : ctx->prefix;
>> cb.create = 0;
>> - ret = imap_exec_m(ctx, &cb, "APPEND \"%s%s\" %s", prefix, box, flagstr);
>> + ret = imap_exec_m(ctx, &cb, "APPEND \"%s%s\"", prefix, box);
>
> Before this change, the command is
>
> "APPEND" SP mailbox SP "{" msglen "}" CRLF
>
> . After this change, it leaves out the space before the brace. If I
> understand RFC3501 correctly, the space is required. Intentional?
No, not intentional. I simply didn't follow far enough how the string
was used and mistakenly thought it was an entire command. Thanks for
finding and fixing this.
(It probably would be less error-prone if v_issue_imap_cmd() would be
responsible for adding the extra space in the second branch of the
following if statement:
if (!cmd->cb.data)
bufl = nfsnprintf(buf, sizeof(buf), "%d %s\r\n", cmd->tag,
cmd->cmd);
else
bufl = nfsnprintf(buf, sizeof(buf), "%d %s{%d%s}\r\n",
cmd->tag, cmd->cmd, cmd->cb.dlen,
CAP(LITERALPLUS) ? "+" : "");
but that's a design choice that was already in the original version and
I don't care enough to change it.)
> With the below squashed in,
> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
>
> diff --git i/imap-send.c w/imap-send.c
> index 451d5027..f1c8f5a5 100644
> --- i/imap-send.c
> +++ w/imap-send.c
> @@ -1296,7 +1296,7 @@ static int imap_store_msg(struct store *gctx, struct msg_data *msg)
> box = gctx->name;
> prefix = !strcmp(box, "INBOX") ? "" : ctx->prefix;
> cb.create = 0;
> - ret = imap_exec_m(ctx, &cb, "APPEND \"%s%s\"", prefix, box);
> + ret = imap_exec_m(ctx, &cb, "APPEND \"%s%s\" ", prefix, box);
> imap->caps = imap->rcaps;
> if (ret != DRV_OK)
> return ret;
>
ACK.
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
^ permalink raw reply
* [BUG] Bug in git stash
From: Nikolay Frantsev @ 2013-01-14 9:18 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 2099 bytes --]
Hi, I found very strange bug in git stash. Testcase attached to this mail.
1. I have a test repo with two modified files and one new file with
content witch added to commit (see repo in attached file):
nikolay@localhost:~/Desktop/git-stash_bug/bug$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: 3
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: 1
# modified: 2
#
2. Stashing two modified files into stash named one:
nikolay@localhost:~/Desktop/git-stash_bug/bug$ git stash save --keep-index one
Saved working directory and index state On master: one
HEAD is now at 7e495f9 files added
3. Checking status, files stashed successfully:
nikolay@localhost:~/Desktop/git-stash_bug/bug$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: 3
#
4. Stashing one added to commit file into stash named zero:
nikolay@localhost:~/Desktop/git-stash_bug/bug$ git stash save zero
Saved working directory and index state On master: zero
HEAD is now at 7e495f9 files added
5. Checking status, files stashed successfully:
nikolay@localhost:~/Desktop/git-stash_bug/bug$ git status
# On branch master
nothing to commit, working directory clean
6. Trying to unstash first stashed changes (on step 2), there a bug:
nikolay@localhost:~/Desktop/git-stash_bug/bug$ git stash pop stash@{1}
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: 3
#
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: 1
# modified: 2
#
Dropped stash@{1} (7926ab7285753c179a368a3a7e8ebfb0f39d0437)
Why there a new empty file named 3?
I'm using git 1.8.1, same problem confirmed on git 1.7.12.4.
--
Nikolay Frantsev
Homepage: http://frantsev.ru/
[-- Attachment #2: git-stash_bug.zip --]
[-- Type: application/zip, Size: 13186 bytes --]
^ permalink raw reply
* Re: [PATCH 06/14] imap-send.c: remove some unused fields from struct store
From: Michael Haggerty @ 2013-01-14 9:25 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Junio C Hamano, Jeff King, git
In-Reply-To: <20130114061920.GE3125@elie.Belkin>
On 01/14/2013 07:19 AM, Jonathan Nieder wrote:
> Michael Haggerty wrote:
>
>> --- a/imap-send.c
>> +++ b/imap-send.c
> [...]
>> @@ -772,13 +767,10 @@ static int get_cmd_result(struct imap_store *ctx, struct imap_cmd *tcmd)
>> !strcmp("NO", arg) || !strcmp("BYE", arg)) {
>> if ((resp = parse_response_code(ctx, NULL, cmd)) != RESP_OK)
>> return resp;
>> - } else if (!strcmp("CAPABILITY", arg))
>> + } else if (!strcmp("CAPABILITY", arg)) {
>> parse_capability(imap, cmd);
>> - else if ((arg1 = next_arg(&cmd))) {
>> - if (!strcmp("EXISTS", arg1))
>> - ctx->gen.count = atoi(arg);
>> - else if (!strcmp("RECENT", arg1))
>> - ctx->gen.recent = atoi(arg);
>> + } else if ((arg1 = next_arg(&cmd))) {
>> + /* unused */
>
> Neat. Let me try to understand what was going on here:
>
> When opening a mailbox with the SELECT command, an IMAP server
> responds with tagged data indicating how many messages exist and how
> many are marked Recent. But git imap-send never reads mailboxes and
> in particular never uses the SELECT command, so there is no need for
> us to parse or record such responses.
>
> Out of paranoia we are keeping the parsing for now, but the parsed
> response is unused, hence the comment above.
>
> If I've understood correctly so far (a big assumption), I still am not
> sure what it would mean if we hit this ((arg1 = next_arg(&cmd))) case.
> Does it mean:
>
> A. The server has gone haywire and given a tagged response where
> one is not allowed, but let's tolerate it because we always have
> done so? Or
>
> B. This is a perfectly normal response to some of the commands we
> send, and we have always been deliberately ignoring it because it
> is not important for what imap-send does?
Honestly, I didn't bother to look into this. I was just doing some
brainless elimination of obviously unused code.
No doubt a deeper analysis (like yours) could find more code to discard,
but I didn't want to invest that much time and this code has absolutely
no tests, so I stuck to the obvious (and even then you found a mistake
in my changes :-( ).
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
^ permalink raw reply
* Re: [PATCH 09/14] imap-send.c: remove namespace fields from struct imap
From: Michael Haggerty @ 2013-01-14 9:31 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Junio C Hamano, Jeff King, git
In-Reply-To: <20130114064347.GH3125@elie.Belkin>
On 01/14/2013 07:43 AM, Jonathan Nieder wrote:
> Michael Haggerty wrote:
>
> [...]
>> @@ -722,9 +667,9 @@ static int get_cmd_result(struct imap_store *ctx, struct imap_cmd *tcmd)
>> }
>>
>> if (!strcmp("NAMESPACE", arg)) {
>> - imap->ns_personal = parse_list(&cmd);
>> - imap->ns_other = parse_list(&cmd);
>> - imap->ns_shared = parse_list(&cmd);
>> + skip_list(&cmd);
>> + skip_list(&cmd);
>> + skip_list(&cmd);
>
> This codepath would only be triggered if we emit a NAMESPACE command,
> right? If I am understanding correctly, a comment could make this
> less mystifying:
>
> /* rfc2342 NAMESPACE response. */
> skip_list(&cmd); /* Personal mailboxes */
> skip_list(&cmd); /* Others' mailboxes */
> skip_list(&cmd); /* Shared mailboxes */
Yes, the comments are useful.
> Though that's probably academic since hopefully this if branch
> will die soon. :)
Not by my hand :-) Maybe somebody more familiar with the IMAP protocol
wants to take the code culling further...
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
^ permalink raw reply
* Re: [PATCH 00/14] Remove unused code from imap-send.c
From: Michael Haggerty @ 2013-01-14 9:33 UTC (permalink / raw)
To: Jonathan Nieder; +Cc: Junio C Hamano, Jeff King, git
In-Reply-To: <20130114065757.GK3125@elie.Belkin>
On 01/14/2013 07:57 AM, Jonathan Nieder wrote:
> Michael Haggerty wrote:
>
>> imap-send.c | 286 +++++++++---------------------------------------------------
>> 1 file changed, 39 insertions(+), 247 deletions(-)
>
> See my replies for comments on patches 1, 6, 9, 11, and 12. The rest
> are
>
> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
>
> The series is tasteful and easy to follow and it's hard to argue with
> the resulting code reduction. Thanks for a pleasant read.
Thanks for your careful review. I will re-roll the patch series as soon
as I get the chance.
Michael
--
Michael Haggerty
mhagger@alum.mit.edu
http://softwareswirl.blogspot.com/
^ permalink raw reply
* Re: [PATCH 2/8] git_remote_helpers: fix input when running under Python 3
From: John Keeping @ 2013-01-14 9:47 UTC (permalink / raw)
To: Michael Haggerty; +Cc: git, Eric S. Raymond, Felipe Contreras, Sverre Rabbelier
In-Reply-To: <50F38E12.6090207@alum.mit.edu>
On Mon, Jan 14, 2013 at 05:48:18AM +0100, Michael Haggerty wrote:
> On 01/13/2013 05:17 PM, John Keeping wrote:
>> On Sun, Jan 13, 2013 at 04:26:39AM +0100, Michael Haggerty wrote:
>>> On 01/12/2013 08:23 PM, John Keeping wrote:
>>>> Although 2to3 will fix most issues in Python 2 code to make it run under
>>>> Python 3, it does not handle the new strict separation between byte
>>>> strings and unicode strings. There is one instance in
>>>> git_remote_helpers where we are caught by this.
>>>>
>>>> Fix it by explicitly decoding the incoming byte string into a unicode
>>>> string. In this instance, use the locale under which the application is
>>>> running.
>>>>
>>>> Signed-off-by: John Keeping <john@keeping.me.uk>
>>>> ---
>>>> git_remote_helpers/git/importer.py | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/git_remote_helpers/git/importer.py b/git_remote_helpers/git/importer.py
>>>> index e28cc8f..6814003 100644
>>>> --- a/git_remote_helpers/git/importer.py
>>>> +++ b/git_remote_helpers/git/importer.py
>>>> @@ -20,7 +20,7 @@ class GitImporter(object):
>>>> """Returns a dictionary with refs.
>>>> """
>>>> args = ["git", "--git-dir=" + gitdir, "for-each-ref", "refs/heads"]
>>>> - lines = check_output(args).strip().split('\n')
>>>> + lines = check_output(args).decode().strip().split('\n')
>>>> refs = {}
>>>> for line in lines:
>>>> value, name = line.split(' ')
>>>>
>>>
>>> Won't this change cause an exception if the branch names are not all
>>> valid strings in the current locale's encoding? I don't see how this
>>> assumption is justified (e.g., see git-check-ref-format(1) for the rules
>>> governing reference names).
>>
>> Yes it will. The problem is that for Python 3 we need to decode the
>> byte string into a unicode string, which means we need to know what
>> encoding it is.
>>
>> I don't think we can just say "git-for-each-ref will print refs in
>> UTF-8" since AFAIK git doesn't care what encoding the refs are in - I
>> suspect that's determined by the filesystem which in the end probably
>> maps to whatever bytes the shell fed git when the ref was created.
>>
>> That's why I chose the current locale in this case. I'm hoping someone
>> here will correct me if we can do better, but I don't see any way of
>> avoiding choosing some encoding here if we want to support Python 3
>> (which I think we will, even if we don't right now).
>
> I'm not just trying to be a nuisance here;
You're not being - I think this is a difficult issue and I don't know
myself what the right answer is.
> I'm struggling myself to
> understand how a program that cares about strings-vs-bytes (e.g., a
> Python3 script) should coexist with a program that doesn't (e.g., git
> [1]). I think this will become a big issue if my Python version of the
> commit email script ever gets integrated and then made compatible with
> Python3.
>
> You claim "for Python 3 we need to decode the byte string into a unicode
> string". I understand that Python 3 strings are Unicode, but why/when
> is it necessary to decode data into a Unicode string as opposed to
> leaving it as a byte sequence?
>
> In this particular case (from a cursory look over the code) it seems to
> me that (1) decoding to Unicode will sometimes fail for data that git
> considers valid and (2) there is no obvious reason that the data cannot
> be processed as byte sequences.
I've been thinking about this overnight and I think you're right that
treating them as byte strings in Python is most correct. Having said
that, when I'm programming in Python I would find it quite surprising
that I had to treat ref strings specially - and as soon as I want to use
one in a string context (e.g. printing it as part of a message to the
user) I'm back to the same problem.
So I think we should try to solve the problem once rather than forcing
everyone who wants to use the library to solve it individually. I just
wish it was obvious what we should do!
John
^ permalink raw reply
* Re: [BUG] Bug in git stash
From: Johannes Sixt @ 2013-01-14 11:45 UTC (permalink / raw)
To: Nikolay Frantsev; +Cc: git
In-Reply-To: <CAOJsraHfKRoK1G8tA2ROUH6qt-q0kG6WesZr5enOeeqFF_AC=w@mail.gmail.com>
Am 1/14/2013 10:18, schrieb Nikolay Frantsev:
> nikolay@localhost:~/Desktop/git-stash_bug/bug$ git status
> # On branch master
> # Changes to be committed:
> # (use "git reset HEAD <file>..." to unstage)
> #
> # new file: 3
> #
> # Changes not staged for commit:
> # (use "git add <file>..." to update what will be committed)
> # (use "git checkout -- <file>..." to discard changes in working directory)
> #
> # modified: 1
> # modified: 2
> #
> nikolay@localhost:~/Desktop/git-stash_bug/bug$ git stash save --keep-index one
> Saved working directory and index state On master: one
> HEAD is now at 7e495f9 files added
...
> nikolay@localhost:~/Desktop/git-stash_bug/bug$ git stash pop stash@{1}
> # On branch master
> # Changes to be committed:
> # (use "git reset HEAD <file>..." to unstage)
> #
> # new file: 3
> #
> # Changes not staged for commit:
> # (use "git add <file>..." to update what will be committed)
> # (use "git checkout -- <file>..." to discard changes in working directory)
> #
> # modified: 1
> # modified: 2
> #
> Dropped stash@{1} (7926ab7285753c179a368a3a7e8ebfb0f39d0437)
>
> Why there a new empty file named 3?
It is by design. --keep-index only achieves that your staged changes are
not reverted, but nevertheless all changes are stashed away. Therefore,
when you later apply the stash, you also get back the modified index.
-- Hannes
^ permalink raw reply
* Error:non-monotonic index after failed recursive "sed" command
From: George Karpenkov @ 2013-01-14 11:40 UTC (permalink / raw)
To: git
Hi All,
I've managed to corrupt my very valuable repository with a recursive
sed which went wrong.
I wanted to convert all tabs to spaces with the following command:
find ./ -name '*.*' -exec sed -i 's/\t/ /g' {} \;
I think that has changed not only the files in the repo, but the data
files in .git directory itself. As a result, my index became
corrupted, and almost every single command dies:
> git log
error: non-monotonic index
.git/objects/pack/pack-314b1944adebea645526b6724b2044c1313241f5.idx
error: non-monotonic index
.git/objects/pack/pack-75c95b0defe1968b61e4f4e1ab7040d35110bfdc.idx
...
error: non-monotonic index
.git/objects/pack/pack-3da0da48d05140b55f4af1cf87c55a2d7898bdd5.idx
fatal: bad object HEAD
Output for git fsck is even worse:
> git fsck
error: non-monotonic index
.git/objects/pack/pack-434f8445672a92f123accffce651bdb693bd8fcb.idx
...
error: non-monotonic index
.git/objects/pack/pack-0c9d5ae4e2b46dd78dace7533adf6cdfe10326ef.idx
error: non-monotonic index
.git/objects/pack/pack-e8bd5c7f85e96e7e548a62954a8f7c7f223ba9e0.idx
Segmentation fault (core dumped)
Any advice? I've lost about 2 weeks worth of work.
Is there anything better I can try to do other then trying to
reconstruct the data manually from git blobs?
^ permalink raw reply
* Re: Error:non-monotonic index after failed recursive "sed" command
From: Matthieu Moy @ 2013-01-14 12:06 UTC (permalink / raw)
To: George Karpenkov; +Cc: git
In-Reply-To: <CAMoGvRKkSZqcoGtiebu6tuPndzOjQ1=JgQHb+iusAHpUbA2HbA@mail.gmail.com>
George Karpenkov <george@metaworld.ru> writes:
> Hi All,
>
> I've managed to corrupt my very valuable repository with a recursive
> sed which went wrong.
> I wanted to convert all tabs to spaces with the following command:
>
> find ./ -name '*.*' -exec sed -i 's/\t/ /g' {} \;
Clearly, this is a dangerous command as it impacts .git/. However, Git
partially protects you from this kind of error, since object files and
pack files are read-only by default.
My obvious first advice is: make backups of your corrupted repository.
Yes, I said backup_s_, better safe than sorry.
Then, the errors you get are in *.idx files, which are basically index
for pack files, for quicker access. You can try removing these files,
and then running "git index-pack" on each pack file, like
$ rm .git/objects/pack/pack-*.idx
$ git index-pack .git/objects/pack/pack-4745076928ca4df932a3727b8cc25e83574560bb.pack
4745076928ca4df932a3727b8cc25e83574560bb
$ git index-pack .git/objects/pack/pack-c74a6514f653d0269cdcdf9c1c102d326706bbda.pack
c74a6514f653d0269cdcdf9c1c102d326706bbda
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply
* Re: Error:non-monotonic index after failed recursive "sed" command
From: John Keeping @ 2013-01-14 12:12 UTC (permalink / raw)
To: Matthieu Moy; +Cc: George Karpenkov, git
In-Reply-To: <vpq38y42clj.fsf@grenoble-inp.fr>
On Mon, Jan 14, 2013 at 01:06:16PM +0100, Matthieu Moy wrote:
> George Karpenkov <george@metaworld.ru> writes:
>> I've managed to corrupt my very valuable repository with a recursive
>> sed which went wrong.
>> I wanted to convert all tabs to spaces with the following command:
>>
>> find ./ -name '*.*' -exec sed -i 's/\t/ /g' {} \;
>
> Clearly, this is a dangerous command as it impacts .git/. However, Git
> partially protects you from this kind of error, since object files and
> pack files are read-only by default.
>
> My obvious first advice is: make backups of your corrupted repository.
> Yes, I said backup_s_, better safe than sorry.
Having backed up the corrupt state, another option is to just try
running the reverse command:
find .git -name '*.*' -exec sed -i 's/ /\t/g' {} \;
I had a quick grep over some pack indices here and ' ' doesn't occur
in any of mine whereas '\t' is very common so you may find that the only
' ' sequences are the ones you introduced.
John
^ permalink raw reply
* Re: Error:non-monotonic index after failed recursive "sed" command
From: Johannes Sixt @ 2013-01-14 12:21 UTC (permalink / raw)
To: George Karpenkov; +Cc: git
In-Reply-To: <CAMoGvRKkSZqcoGtiebu6tuPndzOjQ1=JgQHb+iusAHpUbA2HbA@mail.gmail.com>
Am 1/14/2013 12:40, schrieb George Karpenkov:
> I've managed to corrupt my very valuable repository with a recursive
> sed which went wrong.
> I wanted to convert all tabs to spaces with the following command:
>
> find ./ -name '*.*' -exec sed -i 's/\t/ /g' {} \;
>
> I think that has changed not only the files in the repo, but the data
> files in .git directory itself. As a result, my index became
> corrupted, and almost every single command dies:
>
>> git log
> error: non-monotonic index
> ..git/objects/pack/pack-314b1944adebea645526b6724b2044c1313241f5.idx
> error: non-monotonic index
> ..git/objects/pack/pack-75c95b0defe1968b61e4f4e1ab7040d35110bfdc.idx
> ....
> error: non-monotonic index
> ..git/objects/pack/pack-3da0da48d05140b55f4af1cf87c55a2d7898bdd5.idx
> fatal: bad object HEAD
>
> Output for git fsck is even worse:
>
>> git fsck
> error: non-monotonic index
> ..git/objects/pack/pack-434f8445672a92f123accffce651bdb693bd8fcb.idx
> ....
> error: non-monotonic index
> ..git/objects/pack/pack-0c9d5ae4e2b46dd78dace7533adf6cdfe10326ef.idx
> error: non-monotonic index
> ..git/objects/pack/pack-e8bd5c7f85e96e7e548a62954a8f7c7f223ba9e0.idx
> Segmentation fault (core dumped)
>
> Any advice? I've lost about 2 weeks worth of work.
> Is there anything better I can try to do other then trying to
> reconstruct the data manually from git blobs?
First things first: MAKE A COPY OF THE CURRENT STATE of the repository,
including the worktree, so that you have something to go back to if things
get worse later. (At the very least, we want to debug the segfault that we
see above.)
So far that's all I can say about your case. Everything that follows is
just a shot in the dark, and others may have better ideas. Also, look
here:
https://github.com/gitster/git/blob/master/Documentation/howto/recover-corrupted-blob-object.txt
You can remove the *.idx files, because they do not carry essential
information. Now try git fsck; git repack.
Try the reverse edit:
find .git -name '*.*' -exec sed -i 's/ /\t/g' {} \;
Remove .git/index; it can be reconstructed (of course, assuming you
started all this with a clean index; if not, you lose the staged changes).
-- Hannes
^ permalink raw reply
* Re: [PATCH] archive-tar: fix sanity check in config parsing
From: Jeff King @ 2013-01-14 12:44 UTC (permalink / raw)
To: Joachim Schmitz; +Cc: git
In-Reply-To: <kd0evl$ac0$1@ger.gmane.org>
On Mon, Jan 14, 2013 at 09:17:57AM +0100, Joachim Schmitz wrote:
> >For the curious, the original version of the patch[1] read:
> >
> >+ if (prefixcmp(var, "tarfilter."))
> >+ return 0;
> >+ dot = strrchr(var, '.');
> >+ if (dot == var + 9)
> >+ return 0;
> >
> >and when I shortened the config section to "tar" in a re-roll of the
> >series, I missed the corresponding change to the offset.
>
> Wouldn't it then be better ti use strlen("tar") rather than a 3? Or
> at least a comment?
Then you are relying on the two strings being the same, rather than the
string and the length being the same. If you wanted to DRY it up, it
would look like:
diff --git a/archive-tar.c b/archive-tar.c
index d1cce46..a7c0690 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -332,15 +332,17 @@ static int tar_filter_config(const char *var, const char *value, void *data)
const char *type;
int namelen;
- if (prefixcmp(var, "tar."))
+#define SECTION "tar"
+ if (prefixcmp(var, SECTION "."))
return 0;
dot = strrchr(var, '.');
- if (dot == var + 9)
+ if (dot == var + strlen(SECTION))
return 0;
- name = var + 4;
+ name = var + strlen(SECTION) + 1;
namelen = dot - name;
type = dot + 1;
+#undef SECTION
ar = find_tar_filter(name, namelen);
if (!ar) {
(of course there are other variants where you do not use a macro, but
then you need to manually check for the "." after the prefixcmp call).
I dunno. It is technically more robust in that the offsets are computed,
but I think it is a little harder to read. Of course, I wrote the
original so I am probably not a good judge.
We could also potentially encapsulate it in a function. I think the diff
code has a very similar block.
-Peff
^ permalink raw reply related
* Re: [BUG] Possible bug in `remote set-url --add --push`
From: Michael J Gruber @ 2013-01-14 13:07 UTC (permalink / raw)
To: Jardel Weyrich; +Cc: Sascha Cunz, Junio C Hamano, git
In-Reply-To: <CAN8TAOv0Cm8CgiJSweFtRzOqO78OtNKa4G+x7z6M5Bt+odUmiQ@mail.gmail.com>
Jardel Weyrich venit, vidit, dixit 12.01.2013 10:33:
> On Sat, Jan 12, 2013 at 6:44 AM, Sascha Cunz <sascha-ml@babbelbox.org> wrote:
>> Am Freitag, 11. Januar 2013, 23:10:36 schrieb Junio C Hamano:
>>> Jardel Weyrich <jweyrich@gmail.com> writes:
>>>> I believe `remote set-url --add --push` has a bug. Performed tests
>>>> with v1.8.0.1 and v1.8.1 (Mac OS X).
>>>>
>>>> Quoting the relevant part of the documentation:
>>>>> set-url
>>>>>
>>>>> Changes URL remote points to. Sets first URL remote points to
>>>>> matching regex <oldurl> (first URL if no <oldurl> is given) to
>>>>> <newurl>. If <oldurl> doesn’t match any URL, error occurs and
>>>>> nothing is changed.
>>>>>
>>>>> With --push, push URLs are manipulated instead of fetch URLs.
>>>>> With --add, instead of changing some URL, new URL is added.
>>>>> With --delete, instead of changing some URL, all URLs matching regex
>>>>> <url> are deleted. Trying to delete all non-push URLs is an error.>
>>>> Here are some steps to reproduce:
>>>>
>>>> 1. Show the remote URLs
>>>>
>>>> jweyrich@pharao:test_clone1 [* master]$ git remote -v
>>>> origin /Volumes/sandbox/test (fetch)
>>>> origin /Volumes/sandbox/test (push)
>>>>
>>>> 2. Add a new push URL for origin
>>>>
>>>> jweyrich@pharao:test_clone1 [* master]$ git remote set-url --add --push
>>>> origin \>
>>>> /Volumes/sandbox/test_clone2
>>>>
>>>> 3. Check what happened
>>>>
>>>> jweyrich@pharao:test_clone1 [* master]$ git remote -v
>>>> origin /Volumes/sandbox/test (fetch)
>>>> origin /Volumes/sandbox/test_clone2 (push)
>>>
>>> The original pushurl was replaced with the additional one, instead
>>> of being left and the new one getting added. That looks certainly
>>> wrong.
>>>
>>> However, the result of applying the attached patch (either to
>>> v1.7.12 or v1.8.1) still passes the test and I do not think it is
>>> doing anything differently from what you described above.
>>>
>>> What do you get from
>>>
>>> git config -l | grep '^remote\.origin'
>>>
>>> in steps 1. and 3. in your procedure? This question is trying to
>>> tell if your bug is in "git remote -v" or in "git remote set-url".
>>
>> I'm not sure, if there is a bug at all. According to man git-push:
>>
>> The <pushurl> is used for pushes only. It is optional and defaults to
>> <url>.
>> (From the section REMOTES -> Named remote in configuration file)
>>
>> the command:
>> git remote add foo git@foo-fetch.org/some.git
>>
>> will set "remote.foo.url" to "git@foo-fetch.org". Subsequently, fetch and push
>> will use git@foo-fetch.org as url.
>> Fetch will use this url, because "remote.foo.url" explicitly sets this. push
>> will use it in absence of a "remote.foo.pushurl".
>>
>> Now, we're adding a push-url:
>> git remote set-url --add --push foo git@foo-push.org/some.git
>>
>> Relevant parts of config are now looking like:
>> [remote "foo"]
>> url = git@foo-fetch.org/some.git
>> pushurl = git@foo-push.org/some.git
>>
>> Since, pushurl is now given explicitly, git push will use that one (and only
>> that one).
>>
>> If we add another push-url now,
>> git remote set-url --add --push foo git@foo-push-also.org/some.git
>>
>> the next git-push will push to foo-push.org and foo-push-also.org.
>>
>> Now, using --set-url --delete on both of these urls restores the original
>> state: only "remote.foo.url" is set; meaning implicitly pushurl defaults to
>> url again.
>>
>> To me this is exactly what Jardel was observing:
>>
>>> In step 2, Git replaced the original push URL instead of adding a new
>>> one. But it seems to happen only the first time I use `remote set-url
>>> --add --push`. Re-adding the original URL using the same command seems
>>> to work properly.
>>
>>> And FWIW, if I delete (with "set-url --delete") both URLs push, Git
>>> restores the original URL.
>>
>> Or am I missing something here?
>
> You're right. However, as I quoted earlier, the git-remote man-page states:
>
> set-url
> Changes URL remote points to. <suppressed>
> With --push, push URLs are manipulated instead of fetch URLs.
> With --add, instead of changing some URL, new URL is added.
>
> It explicitly mentions that it should **add a new URL**.
> So when I do `git remote set-url --add --push origin
> git://another/repo.git`, I expect git-push to use both the default
> push URL and the new one. Or am I misinterpreting the man-page?
>
>>
>> Might be that the "bug" actually is that the expectation was
>>
>> git remote add foo git@foo-fetch.org/some.git
>>
>> should have created a config like:
>>
>> [remote "foo"]
>> url = git@foo-fetch.org/some.git
>> pushurl = git@foo-fetch.org/some.git
>>
>> since that is what "git remote -v" reports.
>>
>> If that is the case, we might want to amend the output of 'git remote -v' with
>> the information that a pushurl is not explicitly given and thus defaults to
>> url.
>
> Correct. Adding a remote doesn't automatically generate a pushurl for it.
>
> To me, it seems that git-push checks for the existence of pushurl's in
> the config, and if it finds any, it ignores the defaul push URL during
> the actual push. In better words, it pushes only to pushurls, if it
> finds any, otherwise it pushes to the default URL.
>
> To comply with the statements in the git-remote man-page, git-remote
> should add a pushurl configuration containing the default push URL,
> along with the one passed to `set-url --add --push`. Or git-push
> should _not ignore_ the default URL in the presence of pushurls,
> effectively pushing to both. These are the solutions I can think of
> right now, supposing I'm correct about the cause(s).
>
>>
>> Sascha
All that "set-url --push --add" does is adding a remote.foo.pushurl
entry to the config. If there was none, there will be one after that.
If there is no pushurl entry, "push" takes the url entry instead. This
is the "default URL for push", but not a pushurl entry.
It seems to me that everything works as designed, and that the man page
talk about "push URLs" can be read in two ways, one of which is correct
(and which is obvious if you know the above, i.e. the "config
background") and one of which is incorrect (and which may be obvious if
you read just that man page paragraph).
Michael
^ permalink raw reply
* Re: [PATCH] rebase --preserve-merges keeps empty merge commits
From: Neil Horman @ 2013-01-14 14:02 UTC (permalink / raw)
To: Phil Hord; +Cc: git, phil.hord, Martin von Zweigbergk, Junio C Hamano
In-Reply-To: <1358023561-26773-1-git-send-email-hordp@cisco.com>
On Sat, Jan 12, 2013 at 03:46:01PM -0500, Phil Hord wrote:
> Since 90e1818f9a (git-rebase: add keep_empty flag, 2012-04-20)
> 'git rebase --preserve-merges' fails to preserve empty merge commits
> unless --keep-empty is also specified. Merge commits should be
> preserved in order to preserve the structure of the rebased graph,
> even if the merge commit does not introduce changes to the parent.
>
> Teach rebase not to drop merge commits only because they are empty.
>
> A special case which is not handled by this change is for a merge commit
> whose parents are now the same commit because all the previous different
> parents have been dropped as a result of this rebase or some previous
> operation.
> ---
> git-rebase--interactive.sh | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 44901d5..8ed7fcc 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -190,6 +190,11 @@ is_empty_commit() {
> test "$tree" = "$ptree"
> }
>
> +is_merge_commit()
> +{
> + git rev-parse --verify --quiet "$1"^2 >/dev/null 2>&1
> +}
> +
> # Run command with GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and
> # GIT_AUTHOR_DATE exported from the current environment.
> do_with_author () {
> @@ -874,7 +879,7 @@ git rev-list $merges_option --pretty=oneline --abbrev-commit \
> while read -r shortsha1 rest
> do
>
> - if test -z "$keep_empty" && is_empty_commit $shortsha1
> + if test -z "$keep_empty" && is_empty_commit $shortsha1 && ! is_merge_commit $shortsha1
> then
> comment_out="# "
> else
> --
> 1.8.1.dirty
>
>
Seems reasonable
Acked-by: Neil Horman <nhorman@tuxdriver.com>
^ permalink raw reply
* Re: [PATCH] rebase --preserve-merges keeps empty merge commits
From: Matthieu Moy @ 2013-01-14 14:12 UTC (permalink / raw)
To: Phil Hord
Cc: git, phil.hord, Neil Horman, Martin von Zweigbergk,
Junio C Hamano
In-Reply-To: <1358023561-26773-1-git-send-email-hordp@cisco.com>
Phil Hord <hordp@cisco.com> writes:
> Subject: [PATCH] rebase --preserve-merges keeps empty merge commits
I would rephrase it as
rebase --preserve-merges: keep empty merge commits
we usually give orders in commit messages, not state facts (it's not
clear from the existing subject line whether keeping merge commit is the
new behavior or a bug that the commit tries to fix).
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox