mirror of
https://github.com/git/git.git
synced 2024-11-17 14:34:49 +01:00
Merge branch 'master' into next
* master: Fix memory leak in "git rev-list --objects" gitview: Move the console error messages to message dialog gitview: Add key binding for F5. Let git-clone to pass --template=dir option to git-init-db. Make cvsexportcommit create parent directories as needed. Document current cvsexportcommit limitations. Do not call 'cmp' with non-existant -q flag. Fix "--abbrev=xyz" for revision listing t1002: use -U0 instead of --unified=0 format-patch: -n and -k are mutually exclusive.
This commit is contained in:
commit
15cee32e2c
9 changed files with 100 additions and 28 deletions
|
@ -9,8 +9,8 @@ git-clone - Clones a repository
|
|||
SYNOPSIS
|
||||
--------
|
||||
[verse]
|
||||
'git-clone' [-l [-s]] [-q] [-n] [--bare] [-o <name>] [-u <upload-pack>]
|
||||
[--reference <repository>]
|
||||
'git-clone' [--template=<template_directory>] [-l [-s]] [-q] [-n] [--bare]
|
||||
[-o <name>] [-u <upload-pack>] [--reference <repository>]
|
||||
<repository> [<directory>]
|
||||
|
||||
DESCRIPTION
|
||||
|
@ -89,6 +89,11 @@ OPTIONS
|
|||
the command to specify non-default path for the command
|
||||
run on the other end.
|
||||
|
||||
--template=<template_directory>::
|
||||
Specify the directory from which templates will be used;
|
||||
if unset the templates are taken from the installation
|
||||
defined default, typically `/usr/share/git-core/templates`.
|
||||
|
||||
<repository>::
|
||||
The (possibly remote) repository to clone from. It can
|
||||
be any URL git-fetch supports.
|
||||
|
|
|
@ -203,7 +203,7 @@ int cmd_format_patch(int argc, const char **argv, char **envp)
|
|||
|
||||
if (start_number < 0)
|
||||
start_number = 1;
|
||||
if (numbered && keep_subject < 0)
|
||||
if (numbered && keep_subject)
|
||||
die ("-n and -k are mutually exclusive.");
|
||||
|
||||
argc = setup_revisions(argc, argv, &rev, "HEAD");
|
||||
|
|
|
@ -103,6 +103,7 @@ static struct object_list **process_blob(struct blob *blob,
|
|||
if (obj->flags & (UNINTERESTING | SEEN))
|
||||
return p;
|
||||
obj->flags |= SEEN;
|
||||
name = strdup(name);
|
||||
return add_object(obj, p, path, name);
|
||||
}
|
||||
|
||||
|
@ -122,6 +123,7 @@ static struct object_list **process_tree(struct tree *tree,
|
|||
if (parse_tree(tree) < 0)
|
||||
die("bad tree object %s", sha1_to_hex(obj->sha1));
|
||||
obj->flags |= SEEN;
|
||||
name = strdup(name);
|
||||
p = add_object(obj, p, path, name);
|
||||
me.up = path;
|
||||
me.elem = name;
|
||||
|
@ -134,6 +136,7 @@ static struct object_list **process_tree(struct tree *tree,
|
|||
p = process_tree(entry->item.tree, p, &me, entry->name);
|
||||
else
|
||||
p = process_blob(entry->item.blob, p, &me, entry->name);
|
||||
free(entry->name);
|
||||
free(entry);
|
||||
entry = next;
|
||||
}
|
||||
|
|
|
@ -425,7 +425,7 @@ class DiffWindow:
|
|||
class GitView:
|
||||
""" This is the main class
|
||||
"""
|
||||
version = "0.7"
|
||||
version = "0.8"
|
||||
|
||||
def __init__(self, with_diff=0):
|
||||
self.with_diff = with_diff
|
||||
|
@ -449,8 +449,17 @@ class GitView:
|
|||
|
||||
self.accel_group = gtk.AccelGroup()
|
||||
self.window.add_accel_group(self.accel_group)
|
||||
self.accel_group.connect_group(0xffc2, 0, gtk.ACCEL_LOCKED, self.refresh);
|
||||
|
||||
self.construct()
|
||||
self.window.add(self.construct())
|
||||
|
||||
def refresh(self, widget, event=None, *arguments, **keywords):
|
||||
self.get_encoding()
|
||||
self.get_bt_sha1()
|
||||
Commit.children_sha1 = {}
|
||||
self.set_branch(sys.argv[without_diff:])
|
||||
self.window.show()
|
||||
return True
|
||||
|
||||
def get_bt_sha1(self):
|
||||
""" Update the bt_sha1 dictionary with the
|
||||
|
@ -500,9 +509,9 @@ class GitView:
|
|||
menu_bar.show()
|
||||
vbox.pack_start(menu_bar, expand=False, fill=True)
|
||||
vbox.pack_start(paned, expand=True, fill=True)
|
||||
self.window.add(vbox)
|
||||
paned.show()
|
||||
vbox.show()
|
||||
return vbox
|
||||
|
||||
|
||||
def construct_top(self):
|
||||
|
@ -974,10 +983,15 @@ class GitView:
|
|||
try:
|
||||
self.treeview.set_cursor(self.index[revid])
|
||||
except KeyError:
|
||||
print "Revision %s not present in the list" % revid
|
||||
dialog = gtk.MessageDialog(parent=None, flags=0,
|
||||
type=gtk.MESSAGE_WARNING, buttons=gtk.BUTTONS_CLOSE,
|
||||
message_format=None)
|
||||
dialog.set_markup("Revision <b>%s</b> not present in the list" % revid)
|
||||
# revid == 0 is the parent of the first commit
|
||||
if (revid != 0 ):
|
||||
print "Try running gitview without any options"
|
||||
dialog.format_secondary_text("Try running gitview without any options")
|
||||
dialog.run()
|
||||
dialog.destroy()
|
||||
|
||||
self.treeview.grab_focus()
|
||||
|
||||
|
@ -987,8 +1001,8 @@ class GitView:
|
|||
window.set_diff(commit_sha1, parent_sha1, encoding)
|
||||
self.treeview.grab_focus()
|
||||
|
||||
if __name__ == "__main__":
|
||||
without_diff = 0
|
||||
if __name__ == "__main__":
|
||||
|
||||
if (len(sys.argv) > 1 ):
|
||||
if (sys.argv[1] == "--without-diff"):
|
||||
|
|
|
@ -25,6 +25,9 @@ OPTIONS
|
|||
|
||||
<args>
|
||||
All the valid option for git-rev-list(1)
|
||||
Key Bindings:
|
||||
F5:
|
||||
To reread references.
|
||||
|
||||
EXAMPLES
|
||||
------
|
||||
|
@ -35,4 +38,3 @@ EXAMPLES
|
|||
gitview --since=2.weeks.ago
|
||||
Show the changes during the last two weeks
|
||||
|
||||
|
||||
|
|
10
git-clone.sh
10
git-clone.sh
|
@ -9,7 +9,7 @@
|
|||
unset CDPATH
|
||||
|
||||
usage() {
|
||||
echo >&2 "Usage: $0 [--use-separate-remote] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [-n] <repo> [<dir>]"
|
||||
echo >&2 "Usage: $0 [--template=<template_directory>] [--use-separate-remote] [--reference <reference-repo>] [--bare] [-l [-s]] [-q] [-u <upload-pack>] [--origin <name>] [-n] <repo> [<dir>]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,7 @@ quiet=
|
|||
local=no
|
||||
use_local=no
|
||||
local_shared=no
|
||||
unset template
|
||||
no_checkout=
|
||||
upload_pack=
|
||||
bare=
|
||||
|
@ -120,6 +121,11 @@ while
|
|||
*,-l|*,--l|*,--lo|*,--loc|*,--loca|*,--local) use_local=yes ;;
|
||||
*,-s|*,--s|*,--sh|*,--sha|*,--shar|*,--share|*,--shared)
|
||||
local_shared=yes; use_local=yes ;;
|
||||
1,--template) usage ;;
|
||||
*,--template)
|
||||
shift; template="--template=$1" ;;
|
||||
*,--template=*)
|
||||
template="$1" ;;
|
||||
*,-q|*,--quiet) quiet=-q ;;
|
||||
*,--use-separate-remote)
|
||||
use_separate_remote=t ;;
|
||||
|
@ -203,7 +209,7 @@ trap 'err=$?; cd ..; rm -r "$D"; exit $err' 0
|
|||
case "$bare" in
|
||||
yes) GIT_DIR="$D" ;;
|
||||
*) GIT_DIR="$D/.git" ;;
|
||||
esac && export GIT_DIR && git-init-db || usage
|
||||
esac && export GIT_DIR && git-init-db ${template+"$template"} || usage
|
||||
case "$bare" in
|
||||
yes)
|
||||
GIT_DIR="$D" ;;
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
# Known limitations:
|
||||
# - cannot add or remove binary files
|
||||
# - does not propagate permissions
|
||||
# - tells "ready for commit" even when things could not be completed
|
||||
# (eg addition of a binary file)
|
||||
|
||||
use strict;
|
||||
use Getopt::Std;
|
||||
use File::Temp qw(tempdir);
|
||||
use Data::Dumper;
|
||||
use File::Basename qw(basename);
|
||||
use File::Basename qw(basename dirname);
|
||||
|
||||
unless ($ENV{GIT_DIR} && -r $ENV{GIT_DIR}){
|
||||
die "GIT_DIR is not defined or is unreadable";
|
||||
|
@ -84,7 +90,7 @@
|
|||
`git-cat-file commit $commit | sed -e '1,/^\$/d' >> .msg`;
|
||||
$? && die "Error extracting the commit message";
|
||||
|
||||
my (@afiles, @dfiles, @mfiles);
|
||||
my (@afiles, @dfiles, @mfiles, @dirs);
|
||||
my @files = safe_pipe_capture('git-diff-tree', '-r', $parent, $commit);
|
||||
#print @files;
|
||||
$? && die "Error in git-diff-tree";
|
||||
|
@ -92,7 +98,14 @@
|
|||
chomp $f;
|
||||
my @fields = split(m!\s+!, $f);
|
||||
if ($fields[4] eq 'A') {
|
||||
push @afiles, $fields[5];
|
||||
my $path = $fields[5];
|
||||
push @afiles, $path;
|
||||
# add any needed parent directories
|
||||
$path = dirname $path;
|
||||
while (!-d $path and ! grep { $_ eq $path } @dirs) {
|
||||
unshift @dirs, $path;
|
||||
$path = dirname $path;
|
||||
}
|
||||
}
|
||||
if ($fields[4] eq 'M') {
|
||||
push @mfiles, $fields[5];
|
||||
|
@ -107,13 +120,21 @@
|
|||
|
||||
# check that the files are clean and up to date according to cvs
|
||||
my $dirty;
|
||||
foreach my $d (@dirs) {
|
||||
if (-e $d) {
|
||||
$dirty = 1;
|
||||
warn "$d exists and is not a directory!\n";
|
||||
}
|
||||
}
|
||||
foreach my $f (@afiles) {
|
||||
# This should return only one value
|
||||
my @status = grep(m/^File/, safe_pipe_capture('cvs', '-q', 'status' ,$f));
|
||||
if (@status > 1) { warn 'Strange! cvs status returned more than one line?'};
|
||||
unless ($status[0] =~ m/Status: Unknown$/) {
|
||||
if (-d dirname $f and $status[0] !~ m/Status: Unknown$/
|
||||
and $status[0] !~ m/^File: no file /) {
|
||||
$dirty = 1;
|
||||
warn "File $f is already known in your CVS checkout -- perhaps it has been added by another user. Or this may indicate that it exists on a different branch. If this is the case, use -f to force the merge.\n";
|
||||
warn "Status was: $status\n";
|
||||
}
|
||||
}
|
||||
foreach my $f (@mfiles, @dfiles) {
|
||||
|
@ -139,6 +160,19 @@
|
|||
###
|
||||
|
||||
|
||||
print "Creating new directories\n";
|
||||
foreach my $d (@dirs) {
|
||||
unless (mkdir $d) {
|
||||
warn "Could not mkdir $d: $!";
|
||||
$dirty = 1;
|
||||
}
|
||||
`cvs add $d`;
|
||||
if ($?) {
|
||||
$dirty = 1;
|
||||
warn "Failed to cvs add directory $d -- you may need to do it manually";
|
||||
}
|
||||
}
|
||||
|
||||
print "'Patching' binary files\n";
|
||||
|
||||
my @bfiles = grep(m/^Binary/, safe_pipe_capture('git-diff-tree', '-p', $parent, $commit));
|
||||
|
@ -151,7 +185,7 @@
|
|||
my $blob = `git-ls-tree $tree "$f" | cut -f 1 | cut -d ' ' -f 3`;
|
||||
chomp $blob;
|
||||
`git-cat-file blob $blob > $tmpdir/blob`;
|
||||
if (system('cmp', '-q', $f, "$tmpdir/blob")) {
|
||||
if (system('cmp', '-s', $f, "$tmpdir/blob")) {
|
||||
warn "Binary file $f in CVS does not match parent.\n";
|
||||
$dirty = 1;
|
||||
next;
|
||||
|
|
|
@ -733,6 +733,14 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
|
|||
revs->abbrev = DEFAULT_ABBREV;
|
||||
continue;
|
||||
}
|
||||
if (!strncmp(arg, "--abbrev=", 9)) {
|
||||
revs->abbrev = strtoul(arg + 9, NULL, 10);
|
||||
if (revs->abbrev < MINIMUM_ABBREV)
|
||||
revs->abbrev = MINIMUM_ABBREV;
|
||||
else if (revs->abbrev > 40)
|
||||
revs->abbrev = 40;
|
||||
continue;
|
||||
}
|
||||
if (!strcmp(arg, "--abbrev-commit")) {
|
||||
revs->abbrev_commit = 1;
|
||||
continue;
|
||||
|
|
|
@ -75,7 +75,7 @@ test_expect_success \
|
|||
git-update-index --add yomin &&
|
||||
git-read-tree -m -u $treeH $treeM &&
|
||||
git-ls-files --stage >4.out || return 1
|
||||
diff --unified=0 M.out 4.out >4diff.out
|
||||
diff -U0 M.out 4.out >4diff.out
|
||||
compare_change 4diff.out expected &&
|
||||
check_cache_at yomin clean &&
|
||||
sum bozbar frotz nitfol >actual4.sum &&
|
||||
|
@ -94,7 +94,7 @@ test_expect_success \
|
|||
echo yomin yomin >yomin &&
|
||||
git-read-tree -m -u $treeH $treeM &&
|
||||
git-ls-files --stage >5.out || return 1
|
||||
diff --unified=0 M.out 5.out >5diff.out
|
||||
diff -U0 M.out 5.out >5diff.out
|
||||
compare_change 5diff.out expected &&
|
||||
check_cache_at yomin dirty &&
|
||||
sum bozbar frotz nitfol >actual5.sum &&
|
||||
|
@ -112,7 +112,7 @@ test_expect_success \
|
|||
git-update-index --add frotz &&
|
||||
git-read-tree -m -u $treeH $treeM &&
|
||||
git-ls-files --stage >6.out &&
|
||||
diff --unified=0 M.out 6.out &&
|
||||
diff -U0 M.out 6.out &&
|
||||
check_cache_at frotz clean &&
|
||||
sum bozbar frotz nitfol >actual3.sum &&
|
||||
cmp M.sum actual3.sum &&
|
||||
|
@ -129,7 +129,7 @@ test_expect_success \
|
|||
echo frotz frotz >frotz &&
|
||||
git-read-tree -m -u $treeH $treeM &&
|
||||
git-ls-files --stage >7.out &&
|
||||
diff --unified=0 M.out 7.out &&
|
||||
diff -U0 M.out 7.out &&
|
||||
check_cache_at frotz dirty &&
|
||||
sum bozbar frotz nitfol >actual7.sum &&
|
||||
if cmp M.sum actual7.sum; then false; else :; fi &&
|
||||
|
@ -206,7 +206,7 @@ test_expect_success \
|
|||
git-update-index --add nitfol &&
|
||||
git-read-tree -m -u $treeH $treeM &&
|
||||
git-ls-files --stage >14.out || return 1
|
||||
diff --unified=0 M.out 14.out >14diff.out
|
||||
diff -U0 M.out 14.out >14diff.out
|
||||
compare_change 14diff.out expected &&
|
||||
sum bozbar frotz >actual14.sum &&
|
||||
grep -v nitfol M.sum > expected14.sum &&
|
||||
|
@ -227,7 +227,7 @@ test_expect_success \
|
|||
echo nitfol nitfol nitfol >nitfol &&
|
||||
git-read-tree -m -u $treeH $treeM &&
|
||||
git-ls-files --stage >15.out || return 1
|
||||
diff --unified=0 M.out 15.out >15diff.out
|
||||
diff -U0 M.out 15.out >15diff.out
|
||||
compare_change 15diff.out expected &&
|
||||
check_cache_at nitfol dirty &&
|
||||
sum bozbar frotz >actual15.sum &&
|
||||
|
@ -264,7 +264,7 @@ test_expect_success \
|
|||
git-update-index --add bozbar &&
|
||||
git-read-tree -m -u $treeH $treeM &&
|
||||
git-ls-files --stage >18.out &&
|
||||
diff --unified=0 M.out 18.out &&
|
||||
diff -U0 M.out 18.out &&
|
||||
check_cache_at bozbar clean &&
|
||||
sum bozbar frotz nitfol >actual18.sum &&
|
||||
cmp M.sum actual18.sum'
|
||||
|
@ -278,7 +278,7 @@ test_expect_success \
|
|||
echo gnusto gnusto >bozbar &&
|
||||
git-read-tree -m -u $treeH $treeM &&
|
||||
git-ls-files --stage >19.out &&
|
||||
diff --unified=0 M.out 19.out &&
|
||||
diff -U0 M.out 19.out &&
|
||||
check_cache_at bozbar dirty &&
|
||||
sum frotz nitfol >actual19.sum &&
|
||||
grep -v bozbar M.sum > expected19.sum &&
|
||||
|
@ -297,7 +297,7 @@ test_expect_success \
|
|||
git-update-index --add bozbar &&
|
||||
git-read-tree -m -u $treeH $treeM &&
|
||||
git-ls-files --stage >20.out &&
|
||||
diff --unified=0 M.out 20.out &&
|
||||
diff -U0 M.out 20.out &&
|
||||
check_cache_at bozbar clean &&
|
||||
sum bozbar frotz nitfol >actual20.sum &&
|
||||
cmp M.sum actual20.sum'
|
||||
|
@ -338,7 +338,7 @@ test_expect_success \
|
|||
git-update-index --add DF &&
|
||||
git-read-tree -m -u $treeDF $treeDFDF &&
|
||||
git-ls-files --stage >DFDFcheck.out &&
|
||||
diff --unified=0 DFDF.out DFDFcheck.out &&
|
||||
diff -U0 DFDF.out DFDFcheck.out &&
|
||||
check_cache_at DF/DF clean'
|
||||
|
||||
test_done
|
||||
|
|
Loading…
Reference in a new issue