* [PATCH 1/3] git-cvsexportcommit.perl tabified
From: Michael Witten @ 2007-10-16 8:08 UTC (permalink / raw)
To: git; +Cc: Michael Witten
Signed-off-by: Michael Witten <mfwitten@mit.edu>
---
This patch attempts to tabify this code.
Please be gentle, this is my second time
submitting a patch.
git-cvsexportcommit.perl | 284 +++++++++++++++++++++++-----------------------
1 files changed, 141 insertions(+), 143 deletions(-)
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index a33fa8d..b330c3d 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -12,7 +12,7 @@ use Data::Dumper;
use File::Basename qw(basename dirname);
unless ($ENV{GIT_DIR} && -r $ENV{GIT_DIR}){
- die "GIT_DIR is not defined or is unreadable";
+ die "GIT_DIR is not defined or is unreadable";
}
our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d, $opt_u);
@@ -25,15 +25,13 @@ die "Need at least one commit identifier!" unless @ARGV;
my @cvs;
if ($opt_d) {
- @cvs = ('cvs', '-d', $opt_d);
+ @cvs = ('cvs', '-d', $opt_d);
} else {
- @cvs = ('cvs');
+ @cvs = ('cvs');
}
# setup a tempdir
-our ($tmpdir, $tmpdirname) = tempdir('git-cvsapplycommit-XXXXXX',
- TMPDIR => 1,
- CLEANUP => 1);
+our ($tmpdir, $tmpdirname) = tempdir('git-cvsapplycommit-XXXXXX', TMPDIR => 1, CLEANUP => 1);
# resolve target commit
my $commit;
@@ -41,18 +39,18 @@ $commit = pop @ARGV;
$commit = safe_pipe_capture('git-rev-parse', '--verify', "$commit^0");
chomp $commit;
if ($?) {
- die "The commit reference $commit did not resolve!";
+ die "The commit reference $commit did not resolve!";
}
# resolve what parent we want
my $parent;
if (@ARGV) {
- $parent = pop @ARGV;
- $parent = safe_pipe_capture('git-rev-parse', '--verify', "$parent^0");
- chomp $parent;
- if ($?) {
- die "The parent reference did not resolve!";
- }
+ $parent = pop @ARGV;
+ $parent = safe_pipe_capture('git-rev-parse', '--verify', "$parent^0");
+ chomp $parent;
+ if ($?) {
+ die "The parent reference did not resolve!";
+ }
}
# find parents from the commit itself
@@ -65,44 +63,44 @@ my $title;
my $msg = '';
foreach my $line (@commit) {
- chomp $line;
- if ($stage eq 'headers' && $line eq '') {
- $stage = 'msg';
- next;
- }
-
- if ($stage eq 'headers') {
- if ($line =~ m/^parent (\w{40})$/) { # found a parent
- push @parents, $1;
- } elsif ($line =~ m/^author (.+) \d+ [-+]\d+$/) {
- $author = $1;
- } elsif ($line =~ m/^committer (.+) \d+ [-+]\d+$/) {
- $committer = $1;
+ chomp $line;
+ if ($stage eq 'headers' && $line eq '') {
+ $stage = 'msg';
+ next;
}
- } else {
- $msg .= $line . "\n";
- unless ($title) {
- $title = $line;
+
+ if ($stage eq 'headers') {
+ if ($line =~ m/^parent (\w{40})$/) { # found a parent
+ push @parents, $1;
+ } elsif ($line =~ m/^author (.+) \d+ [-+]\d+$/) {
+ $author = $1;
+ } elsif ($line =~ m/^committer (.+) \d+ [-+]\d+$/) {
+ $committer = $1;
+ }
+ } else {
+ $msg .= $line . "\n";
+ unless ($title) {
+ $title = $line;
+ }
}
- }
}
if ($parent) {
- my $found;
- # double check that it's a valid parent
- foreach my $p (@parents) {
- if ($p eq $parent) {
- $found = 1;
- last;
- }; # found it
- }
- die "Did not find $parent in the parents for this commit!" if !$found and !$opt_P;
+ my $found;
+ # double check that it's a valid parent
+ foreach my $p (@parents) {
+ if ($p eq $parent) {
+ $found = 1;
+ last;
+ }; # found it
+ }
+ die "Did not find $parent in the parents for this commit!" if !$found and !$opt_P;
} else { # we don't have a parent from the cmdline...
- if (@parents == 1) { # it's safe to get it from the commit
- $parent = $parents[0];
- } else { # or perhaps not!
- die "This commit has more than one parent -- please name the parent you want to use explicitly";
- }
+ if (@parents == 1) { # it's safe to get it from the commit
+ $parent = $parents[0];
+ } else { # or perhaps not!
+ die "This commit has more than one parent -- please name the parent you want to use explicitly";
+ }
}
$opt_v && print "Applying to CVS commit $commit from parent $parent\n";
@@ -110,14 +108,14 @@ $opt_v && print "Applying to CVS commit $commit from parent $parent\n";
# grab the commit message
open(MSG, ">.msg") or die "Cannot open .msg for writing";
if ($opt_m) {
- print MSG $opt_m;
+ print MSG $opt_m;
}
print MSG $msg;
if ($opt_a) {
- print MSG "\n\nAuthor: $author\n";
- if ($author ne $committer) {
- print MSG "Committer: $committer\n";
- }
+ print MSG "\n\nAuthor: $author\n";
+ if ($author ne $committer) {
+ print MSG "Committer: $committer\n";
+ }
}
close MSG;
@@ -153,70 +151,70 @@ map { s/\\([0-7]{3})/sprintf('%c',oct $1)/eg } @bfiles,@files;
my $dirty;
my @dirs;
foreach my $p (@afiles) {
- my $path = dirname $p;
- while (!-d $path and ! grep { $_ eq $path } @dirs) {
- unshift @dirs, $path;
- $path = dirname $path;
- }
+ my $path = dirname $p;
+ while (!-d $path and ! grep { $_ eq $path } @dirs) {
+ unshift @dirs, $path;
+ $path = dirname $path;
+ }
}
# ... check dirs,
foreach my $d (@dirs) {
- if (-e $d) {
- $dirty = 1;
- warn "$d exists and is not a directory!\n";
- }
+ if (-e $d) {
+ $dirty = 1;
+ warn "$d exists and is not a directory!\n";
+ }
}
# ... query status of all files that we have a directory for and parse output of 'cvs status' to %cvsstat.
my @canstatusfiles;
foreach my $f (@files) {
- my $path = dirname $f;
- next if (grep { $_ eq $path } @dirs);
- push @canstatusfiles, $f;
+ my $path = dirname $f;
+ next if (grep { $_ eq $path } @dirs);
+ push @canstatusfiles, $f;
}
my %cvsstat;
if (@canstatusfiles) {
- if ($opt_u) {
- my @updated = safe_pipe_capture(@cvs, 'update', @canstatusfiles);
- print @updated;
- }
- my @cvsoutput;
- @cvsoutput= safe_pipe_capture(@cvs, 'status', @canstatusfiles);
- my $matchcount = 0;
- foreach my $l (@cvsoutput) {
- chomp $l;
- if ( $l =~ /^File:/ and $l =~ /Status: (.*)$/ ) {
- $cvsstat{$canstatusfiles[$matchcount]} = $1;
- $matchcount++;
- }
- }
+ if ($opt_u) {
+ my @updated = safe_pipe_capture(@cvs, 'update', @canstatusfiles);
+ print @updated;
+ }
+ my @cvsoutput;
+ @cvsoutput= safe_pipe_capture(@cvs, 'status', @canstatusfiles);
+ my $matchcount = 0;
+ foreach my $l (@cvsoutput) {
+ chomp $l;
+ if ( $l =~ /^File:/ and $l =~ /Status: (.*)$/ ) {
+ $cvsstat{$canstatusfiles[$matchcount]} = $1;
+ $matchcount++;
+ }
+ }
}
# ... validate new files,
foreach my $f (@afiles) {
- if (defined ($cvsstat{$f}) and $cvsstat{$f} ne "Unknown") {
- $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: $cvsstat{$f}\n";
- }
+ if (defined ($cvsstat{$f}) and $cvsstat{$f} ne "Unknown") {
+ $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: $cvsstat{$f}\n";
+ }
}
# ... validate known files.
foreach my $f (@files) {
- next if grep { $_ eq $f } @afiles;
- # TODO:we need to handle removed in cvs
- unless (defined ($cvsstat{$f}) and $cvsstat{$f} eq "Up-to-date") {
- $dirty = 1;
- warn "File $f not up to date but has status '$cvsstat{$f}' in your CVS checkout!\n";
- }
+ next if grep { $_ eq $f } @afiles;
+ # TODO:we need to handle removed in cvs
+ unless (defined ($cvsstat{$f}) and $cvsstat{$f} eq "Up-to-date") {
+ $dirty = 1;
+ warn "File $f not up to date but has status '$cvsstat{$f}' in your CVS checkout!\n";
+ }
}
if ($dirty) {
- if ($opt_f) { warn "The tree is not clean -- forced merge\n";
- $dirty = 0;
- } else {
- die "Exiting: your CVS tree is not clean for this merge.";
- }
+ if ($opt_f) { warn "The tree is not clean -- forced merge\n";
+ $dirty = 0;
+ } else {
+ die "Exiting: your CVS tree is not clean for this merge.";
+ }
}
print "Applying\n";
@@ -225,30 +223,30 @@ print "Applying\n";
print "Patch applied successfully. Adding new files and directories to CVS\n";
my $dirtypatch = 0;
foreach my $d (@dirs) {
- if (system(@cvs,'add',$d)) {
- $dirtypatch = 1;
- warn "Failed to cvs add directory $d -- you may need to do it manually";
- }
+ if (system(@cvs,'add',$d)) {
+ $dirtypatch = 1;
+ warn "Failed to cvs add directory $d -- you may need to do it manually";
+ }
}
foreach my $f (@afiles) {
- if (grep { $_ eq $f } @bfiles) {
- system(@cvs, 'add','-kb',$f);
- } else {
- system(@cvs, 'add', $f);
- }
- if ($?) {
- $dirtypatch = 1;
- warn "Failed to cvs add $f -- you may need to do it manually";
- }
+ if (grep { $_ eq $f } @bfiles) {
+ system(@cvs, 'add','-kb',$f);
+ } else {
+ system(@cvs, 'add', $f);
+ }
+ if ($?) {
+ $dirtypatch = 1;
+ warn "Failed to cvs add $f -- you may need to do it manually";
+ }
}
foreach my $f (@dfiles) {
- system(@cvs, 'rm', '-f', $f);
- if ($?) {
- $dirtypatch = 1;
- warn "Failed to cvs rm -f $f -- you may need to do it manually";
- }
+ system(@cvs, 'rm', '-f', $f);
+ if ($?) {
+ $dirtypatch = 1;
+ warn "Failed to cvs rm -f $f -- you may need to do it manually";
+ }
}
print "Commit to CVS\n";
@@ -257,25 +255,25 @@ my @commitfiles = map { unless (m/\s/) { '\''.$_.'\''; } else { $_; }; } (@files
my $cmd = join(' ', @cvs)." commit -F .msg @commitfiles";
if ($dirtypatch) {
- print "NOTE: One or more hunks failed to apply cleanly.\n";
- print "You'll need to apply the patch in .cvsexportcommit.diff manually\n";
- print "using a patch program. After applying the patch and resolving the\n";
- print "problems you may commit using:";
- print "\n $cmd\n\n";
- exit(1);
+ print "NOTE: One or more hunks failed to apply cleanly.\n";
+ print "You'll need to apply the patch in .cvsexportcommit.diff manually\n";
+ print "using a patch program. After applying the patch and resolving the\n";
+ print "problems you may commit using:";
+ print "\n $cmd\n\n";
+ exit(1);
}
if ($opt_c) {
- print "Autocommit\n $cmd\n";
- print safe_pipe_capture(@cvs, 'commit', '-F', '.msg', @files);
- if ($?) {
- die "Exiting: The commit did not succeed";
- }
- print "Committed successfully to CVS\n";
- # clean up
- unlink(".msg");
+ print "Autocommit\n $cmd\n";
+ print safe_pipe_capture(@cvs, 'commit', '-F', '.msg', @files);
+ if ($?) {
+ die "Exiting: The commit did not succeed";
+ }
+ print "Committed successfully to CVS\n";
+ # clean up
+ unlink(".msg");
} else {
- print "Ready for you to commit, just run:\n\n $cmd\n";
+ print "Ready for you to commit, just run:\n\n $cmd\n";
}
# clean up
@@ -297,25 +295,25 @@ END
# to work around shell problems with weird characters in arguments
# if the exec returns non-zero we die
sub safe_pipe_capture {
- my @output;
- if (my $pid = open my $child, '-|') {
- @output = (<$child>);
- close $child or die join(' ',@_).": $! $?";
- } else {
- exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
- }
- return wantarray ? @output : join('',@output);
+ my @output;
+ if (my $pid = open my $child, '-|') {
+ @output = (<$child>);
+ close $child or die join(' ',@_).": $! $?";
+ } else {
+ exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
+ }
+ return wantarray ? @output : join('',@output);
}
sub safe_pipe_capture_blob {
- my $output;
- if (my $pid = open my $child, '-|') {
- local $/;
- undef $/;
- $output = (<$child>);
- close $child or die join(' ',@_).": $! $?";
- } else {
- exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
- }
- return $output;
+ my $output;
+ if (my $pid = open my $child, '-|') {
+ local $/;
+ undef $/;
+ $output = (<$child>);
+ close $child or die join(' ',@_).": $! $?";
+ } else {
+ exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
+ }
+ return $output;
}
--
1.5.3.4.207.g6d7480-dirty
^ permalink raw reply related
* [PATCH] git-cvsexportcommit.perl tabified
From: Michael Witten @ 2007-10-16 9:56 UTC (permalink / raw)
To: git; +Cc: spearce, Michael Witten
---
This patch can be applied to spearce/next
The other patch for removing --binary should
still be applicable.
git-cvsexportcommit.perl | 277 +++++++++++++++++++++++-----------------------
1 files changed, 139 insertions(+), 138 deletions(-)
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index 6b0123c..9dac7aa 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -12,7 +12,7 @@ use Data::Dumper;
use File::Basename qw(basename dirname);
unless ($ENV{GIT_DIR} && -r $ENV{GIT_DIR}){
- die "GIT_DIR is not defined or is unreadable";
+ die "GIT_DIR is not defined or is unreadable";
}
our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d, $opt_u);
@@ -36,18 +36,18 @@ $commit = pop @ARGV;
$commit = safe_pipe_capture('git-rev-parse', '--verify', "$commit^0");
chomp $commit;
if ($?) {
- die "The commit reference $commit did not resolve!";
+ die "The commit reference $commit did not resolve!";
}
# resolve what parent we want
my $parent;
if (@ARGV) {
- $parent = pop @ARGV;
- $parent = safe_pipe_capture('git-rev-parse', '--verify', "$parent^0");
- chomp $parent;
- if ($?) {
- die "The parent reference did not resolve!";
- }
+ $parent = pop @ARGV;
+ $parent = safe_pipe_capture('git-rev-parse', '--verify', "$parent^0");
+ chomp $parent;
+ if ($?) {
+ die "The parent reference did not resolve!";
+ }
}
# find parents from the commit itself
@@ -60,44 +60,44 @@ my $title;
my $msg = '';
foreach my $line (@commit) {
- chomp $line;
- if ($stage eq 'headers' && $line eq '') {
- $stage = 'msg';
- next;
- }
-
- if ($stage eq 'headers') {
- if ($line =~ m/^parent (\w{40})$/) { # found a parent
- push @parents, $1;
- } elsif ($line =~ m/^author (.+) \d+ [-+]\d+$/) {
- $author = $1;
- } elsif ($line =~ m/^committer (.+) \d+ [-+]\d+$/) {
- $committer = $1;
+ chomp $line;
+ if ($stage eq 'headers' && $line eq '') {
+ $stage = 'msg';
+ next;
}
- } else {
- $msg .= $line . "\n";
- unless ($title) {
- $title = $line;
+
+ if ($stage eq 'headers') {
+ if ($line =~ m/^parent (\w{40})$/) { # found a parent
+ push @parents, $1;
+ } elsif ($line =~ m/^author (.+) \d+ [-+]\d+$/) {
+ $author = $1;
+ } elsif ($line =~ m/^committer (.+) \d+ [-+]\d+$/) {
+ $committer = $1;
+ }
+ } else {
+ $msg .= $line . "\n";
+ unless ($title) {
+ $title = $line;
+ }
}
- }
}
if ($parent) {
- my $found;
- # double check that it's a valid parent
- foreach my $p (@parents) {
- if ($p eq $parent) {
- $found = 1;
- last;
- }; # found it
- }
- die "Did not find $parent in the parents for this commit!" if !$found and !$opt_P;
+ my $found;
+ # double check that it's a valid parent
+ foreach my $p (@parents) {
+ if ($p eq $parent) {
+ $found = 1;
+ last;
+ }; # found it
+ }
+ die "Did not find $parent in the parents for this commit!" if !$found and !$opt_P;
} else { # we don't have a parent from the cmdline...
- if (@parents == 1) { # it's safe to get it from the commit
- $parent = $parents[0];
- } else { # or perhaps not!
- die "This commit has more than one parent -- please name the parent you want to use explicitly";
- }
+ if (@parents == 1) { # it's safe to get it from the commit
+ $parent = $parents[0];
+ } else { # or perhaps not!
+ die "This commit has more than one parent -- please name the parent you want to use explicitly";
+ }
}
$opt_v && print "Applying to CVS commit $commit from parent $parent\n";
@@ -105,14 +105,14 @@ $opt_v && print "Applying to CVS commit $commit from parent $parent\n";
# grab the commit message
open(MSG, ">.msg") or die "Cannot open .msg for writing";
if ($opt_m) {
- print MSG $opt_m;
+ print MSG $opt_m;
}
print MSG $msg;
if ($opt_a) {
- print MSG "\n\nAuthor: $author\n";
- if ($author ne $committer) {
- print MSG "Committer: $committer\n";
- }
+ print MSG "\n\nAuthor: $author\n";
+ if ($author ne $committer) {
+ print MSG "Committer: $committer\n";
+ }
}
close MSG;
@@ -148,70 +148,71 @@ map { s/\\([0-7]{3})/sprintf('%c',oct $1)/eg } @bfiles,@files;
my $dirty;
my @dirs;
foreach my $p (@afiles) {
- my $path = dirname $p;
- while (!-d $path and ! grep { $_ eq $path } @dirs) {
- unshift @dirs, $path;
- $path = dirname $path;
- }
+ my $path = dirname $p;
+ while (!-d $path and ! grep { $_ eq $path } @dirs) {
+ unshift @dirs, $path;
+ $path = dirname $path;
+ }
}
# ... check dirs,
foreach my $d (@dirs) {
- if (-e $d) {
- $dirty = 1;
- warn "$d exists and is not a directory!\n";
- }
+ if (-e $d) {
+ $dirty = 1;
+ warn "$d exists and is not a directory!\n";
+ }
}
# ... query status of all files that we have a directory for and parse output of 'cvs status' to %cvsstat.
my @canstatusfiles;
foreach my $f (@files) {
- my $path = dirname $f;
- next if (grep { $_ eq $path } @dirs);
- push @canstatusfiles, $f;
+ my $path = dirname $f;
+ next if (grep { $_ eq $path } @dirs);
+ push @canstatusfiles, $f;
}
my %cvsstat;
if (@canstatusfiles) {
- if ($opt_u) {
- my @updated = safe_pipe_capture(@cvs, 'update', @canstatusfiles);
- print @updated;
- }
- my @cvsoutput;
- @cvsoutput= safe_pipe_capture(@cvs, 'status', @canstatusfiles);
- my $matchcount = 0;
- foreach my $l (@cvsoutput) {
- chomp $l;
- if ( $l =~ /^File:/ and $l =~ /Status: (.*)$/ ) {
- $cvsstat{$canstatusfiles[$matchcount]} = $1;
- $matchcount++;
- }
- }
+ if ($opt_u) {
+ my @updated = safe_pipe_capture(@cvs, 'update', @canstatusfiles);
+ print @updated;
+ }
+ my @cvsoutput;
+ @cvsoutput= safe_pipe_capture(@cvs, 'status', @canstatusfiles);
+ my $matchcount = 0;
+ foreach my $l (@cvsoutput) {
+ chomp $l;
+ if ( $l =~ /^File:/ and $l =~ /Status: (.*)$/ ) {
+ $cvsstat{$canstatusfiles[$matchcount]} = $1;
+ $matchcount++;
+ }
+ }
}
# ... validate new files,
foreach my $f (@afiles) {
- if (defined ($cvsstat{$f}) and $cvsstat{$f} ne "Unknown") {
- $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: $cvsstat{$f}\n";
- }
+ if (defined ($cvsstat{$f}) and $cvsstat{$f} ne "Unknown") {
+ $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: $cvsstat{$f}\n";
+ }
}
# ... validate known files.
foreach my $f (@files) {
- next if grep { $_ eq $f } @afiles;
- # TODO:we need to handle removed in cvs
- unless (defined ($cvsstat{$f}) and $cvsstat{$f} eq "Up-to-date") {
- $dirty = 1;
- warn "File $f not up to date but has status '$cvsstat{$f}' in your CVS checkout!\n";
- }
+ next if grep { $_ eq $f } @afiles;
+ # TODO:we need to handle removed in cvs
+ unless (defined ($cvsstat{$f}) and $cvsstat{$f} eq "Up-to-date") {
+ $dirty = 1;
+ warn "File $f not up to date but has status '$cvsstat{$f}' in your CVS checkout!\n";
+ }
}
if ($dirty) {
- if ($opt_f) { warn "The tree is not clean -- forced merge\n";
- $dirty = 0;
- } else {
- die "Exiting: your CVS tree is not clean for this merge.";
- }
+ if ($opt_f) {
+ warn "The tree is not clean -- forced merge\n";
+ $dirty = 0;
+ } else {
+ die "Exiting: your CVS tree is not clean for this merge.";
+ }
}
print "Applying\n";
@@ -220,30 +221,30 @@ print "Applying\n";
print "Patch applied successfully. Adding new files and directories to CVS\n";
my $dirtypatch = 0;
foreach my $d (@dirs) {
- if (system(@cvs,'add',$d)) {
- $dirtypatch = 1;
- warn "Failed to cvs add directory $d -- you may need to do it manually";
- }
+ if (system(@cvs,'add',$d)) {
+ $dirtypatch = 1;
+ warn "Failed to cvs add directory $d -- you may need to do it manually";
+ }
}
foreach my $f (@afiles) {
- if (grep { $_ eq $f } @bfiles) {
- system(@cvs, 'add','-kb',$f);
- } else {
- system(@cvs, 'add', $f);
- }
- if ($?) {
- $dirtypatch = 1;
- warn "Failed to cvs add $f -- you may need to do it manually";
- }
+ if (grep { $_ eq $f } @bfiles) {
+ system(@cvs, 'add','-kb',$f);
+ } else {
+ system(@cvs, 'add', $f);
+ }
+ if ($?) {
+ $dirtypatch = 1;
+ warn "Failed to cvs add $f -- you may need to do it manually";
+ }
}
foreach my $f (@dfiles) {
- system(@cvs, 'rm', '-f', $f);
- if ($?) {
- $dirtypatch = 1;
- warn "Failed to cvs rm -f $f -- you may need to do it manually";
- }
+ system(@cvs, 'rm', '-f', $f);
+ if ($?) {
+ $dirtypatch = 1;
+ warn "Failed to cvs rm -f $f -- you may need to do it manually";
+ }
}
print "Commit to CVS\n";
@@ -252,25 +253,25 @@ my @commitfiles = map { unless (m/\s/) { '\''.$_.'\''; } else { $_; }; } (@files
my $cmd = join(' ', @cvs)." commit -F .msg @commitfiles";
if ($dirtypatch) {
- print "NOTE: One or more hunks failed to apply cleanly.\n";
- print "You'll need to apply the patch in .cvsexportcommit.diff manually\n";
- print "using a patch program. After applying the patch and resolving the\n";
- print "problems you may commit using:";
- print "\n $cmd\n\n";
- exit(1);
+ print "NOTE: One or more hunks failed to apply cleanly.\n";
+ print "You'll need to apply the patch in .cvsexportcommit.diff manually\n";
+ print "using a patch program. After applying the patch and resolving the\n";
+ print "problems you may commit using:";
+ print "\n $cmd\n\n";
+ exit(1);
}
if ($opt_c) {
- print "Autocommit\n $cmd\n";
- print safe_pipe_capture(@cvs, 'commit', '-F', '.msg', @files);
- if ($?) {
- die "Exiting: The commit did not succeed";
- }
- print "Committed successfully to CVS\n";
- # clean up
- unlink(".msg");
+ print "Autocommit\n $cmd\n";
+ print safe_pipe_capture(@cvs, 'commit', '-F', '.msg', @files);
+ if ($?) {
+ die "Exiting: The commit did not succeed";
+ }
+ print "Committed successfully to CVS\n";
+ # clean up
+ unlink(".msg");
} else {
- print "Ready for you to commit, just run:\n\n $cmd\n";
+ print "Ready for you to commit, just run:\n\n $cmd\n";
}
# clean up
@@ -292,25 +293,25 @@ END
# to work around shell problems with weird characters in arguments
# if the exec returns non-zero we die
sub safe_pipe_capture {
- my @output;
- if (my $pid = open my $child, '-|') {
- @output = (<$child>);
- close $child or die join(' ',@_).": $! $?";
- } else {
- exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
- }
- return wantarray ? @output : join('',@output);
+ my @output;
+ if (my $pid = open my $child, '-|') {
+ @output = (<$child>);
+ close $child or die join(' ',@_).": $! $?";
+ } else {
+ exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
+ }
+ return wantarray ? @output : join('',@output);
}
sub safe_pipe_capture_blob {
- my $output;
- if (my $pid = open my $child, '-|') {
- local $/;
- undef $/;
- $output = (<$child>);
- close $child or die join(' ',@_).": $! $?";
- } else {
- exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
- }
- return $output;
+ my $output;
+ if (my $pid = open my $child, '-|') {
+ local $/;
+ undef $/;
+ $output = (<$child>);
+ close $child or die join(' ',@_).": $! $?";
+ } else {
+ exec(@_) or die "$! $?"; # exec() can fail the executable can't be found
+ }
+ return $output;
}
--
1.5.3.4.209.g397ef-dirty
^ permalink raw reply related
* [PATCH 2/3] git-cvsexportcommit.perl tmpdir removed
From: Michael Witten @ 2007-10-16 8:08 UTC (permalink / raw)
To: git; +Cc: Michael Witten
In-Reply-To: <1192522094-4988-1-git-send-email-mfwitten@mit.edu>
Signed-off-by: Michael Witten <mfwitten@mit.edu>
---
This is perhaps a duplicate of another patch sent in,
but it applies to the tabified version.
git-cvsexportcommit.perl | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/git-cvsexportcommit.perl b/git-cvsexportcommit.perl
index b330c3d..869c8b5 100755
--- a/git-cvsexportcommit.perl
+++ b/git-cvsexportcommit.perl
@@ -30,9 +30,6 @@ if ($opt_d) {
@cvs = ('cvs');
}
-# setup a tempdir
-our ($tmpdir, $tmpdirname) = tempdir('git-cvsapplycommit-XXXXXX', TMPDIR => 1, CLEANUP => 1);
-
# resolve target commit
my $commit;
$commit = pop @ARGV;
--
1.5.3.4.207.g6d7480-dirty
^ permalink raw reply related
* RE: Is there any plan to support partial checkout or submoudule improvement?
From: franky @ 2007-10-16 9:56 UTC (permalink / raw)
To: 'Lars Hjemli'; +Cc: git
In-Reply-To: <8c5c35580710160142x1f699208gfc226072a27e997a@mail.gmail.com>
> Well, there is always
>
> $ git archive --remote=<repo> <revspec> <path> | tar -x
>
> This is effectively a partial checkout of an arbitrary revision from a
> remote repo.
>
> --
That's actually "a single command", but a little complex. And there still
are some problems with this single command
1. each time is full checkout (not incremental), so bad performance for
large bin directory
2. I can't know deployment version easily and I can't use "git-log" to see
the log and to decide which version to back to when necessary.
I just find an ugly resolution:
1. git-clone host:project.git project
Cloned project is as follows (src, bin are subdir instead of submodule)
project
src
bin
.git
2. cd project && rm -rf src
3. when project.git changed, then
git-fetch && git-checkout origin/master bin
Unfortulately, it's annoying when I run git-status which complains "deleted:
src ". And "git-log" will not show the newest log since git-checkout doesn't
update the index file
So, the alternative for the 3rd step is
git-pull && rm src
It's so ugly!
Suggestion 1: how about adding a paths option for git-status just like
git-diff and git-log
Suggestion 2: how about changes the default paths for "git-diff", "git-log"
and so on from the "top dir with .git" to "the current dir"? So when I'm in
bin directory and run "git-log", it will only report log or diff in bin
directory.
franky
^ permalink raw reply
* Re: [PATCH 1/5] Add a generic tree traversal to fetch SVN properties.
From: Eric Wong @ 2007-10-16 9:55 UTC (permalink / raw)
To: Benoit SIGOURE; +Cc: git
In-Reply-To: <07B09A42-73DD-4565-975F-A4E40BF862AC@lrde.epita.fr>
Benoit SIGOURE <tsuna@lrde.epita.fr> wrote:
> On Oct 16, 2007, at 9:43 AM, Eric Wong wrote:
>
> >Benoit Sigoure <tsuna@lrde.epita.fr> wrote:
> >> * git-svn.perl (&traverse_ignore): Remove.
> >> (&prop_walk): New.
> >> (&cmd_show_ignore): Use prop_walk.
> >>
> >>Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
> >
> >Although I myself have never needed this functionality, this series
> >looks pretty good in general.
>
> I heavily script Git with my own wrappers and having this sort if
> functionality does enhance the scriptability of git-svn.
Ah. I've actually wanted something like `svn info` or `git-svn
rev-parse` myself for a while, but haven't gotten to implementing it
myself, either. Something that could easily give me the current URL of
a repo, or the URL of any path in a repo
$ git svn info --remote-url local/path.c
=> https://example.com/svn/trunk/local/path.c
$ git svn info --url
=> https://example.com/svn/trunk
I think there was other functionality that I've wanted in the past
but have forgotten at the moment. I need to sleep, badly :x
> >Thanks.
>
> You're welcome :)
>
> >
> >One comment below about property selection (whitelist vs blacklist).
> >
> >
> >It would be possible to get identical information out of
> >unhandled.log,
> >but older repositories may not have complete information... Maybe
> >some
> >local option would be good for people with complete unhandled.log
> >files;
> >but it could be really incomplete/insufficient.
> >
>
> In order to avoid using SVN::Ra and avoid access to the SVN repo?
> Hmm, clever, I didn't think about this. Maybe we can provide both,
> the default would check unhandled.log and an option would enable
> direct access to the SVN repo?
Yes. I'm alright with the direct SVN repo code for now, and we can do
unhandled.log later since it's more things to do.
> >Coding style
> >
> >Other than that, I prefer to keep braces on the same line as foreach,
> >if, else statements. I generally follow the git and Linux coding
> >style for C in my Perl code.
> >
> >One exception that I make for Perl (but not C) is that I keep the "{"
> >for subs on the same line (since subs can be nested and anonymous ones
> >passed as arguments and such); unlike their C counterparts[1]
>
> Indeed, sorry, I started correctly but then completely forgot to
> follow the existing Coding Style. The CS I use daily is totally
> different, sorry ;)
> Shall I resend the patch series with corrected CS?
Yes, please. Thanks.
--
Eric Wong
^ permalink raw reply
* Re: .gitignore and svn:ignore [WAS: git-svn and submodules]
From: Karl Hasselström @ 2007-10-16 9:43 UTC (permalink / raw)
To: Eric Wong; +Cc: Chris Shoemaker, Benoit SIGOURE, git list, Johannes Schindelin
In-Reply-To: <20071016075827.GB32348@soma>
On 2007-10-16 00:58:27 -0700, Eric Wong wrote:
> If we support .gitignore <-> svn:ignore in git-svn; bidirectional,
> transparent mapping is the only way I want to go.
Fair enough.
> This means that *all* .gitignore files will be translated to
> svn:ignore files and vice versa; and the .gitignore files will be
> NOT be committed to SVN itself, but present in the git-svn created
> mirrors.
OK.
> Recursive .gitignore definitions will be mapped to svn:ignore
> recursively on the client side; and non-recursive ones will only map
> to one directory.
>
> Sound good?
>
> I may be sleepy at the moment, but the thought of implementing this
> is sounding complicated now...
I think this is a mistake. If a user adds *.foo to the top-level
.gitignore, this will add *.foo to svn:ignore of _every_ directory in
the whole tree. And coming up with semantics that are sane for e.g.
git -> svn -> git roundtrips seems difficult.
It would be better and far simpler to either
1. Move the contents of svn:ignore and .gitignore back and forth
untouched, disregarding the slight semantic mismatch.
git-svnignore does this (albeit only in one direction), and it
works surprisingly well in my experience.
2. Do as in (1), but call the file .svnignore instead of .gitignore.
And have a git-svn command that translates all the .svnignore
files in the tree to corresponding .gitignore files.
> One goal of git-svn is that other users shouldn't be able to tell if
> a user is using git-svn or plain svn; even.
Agreed.
--
Karl Hasselström, kha@treskal.com
www.treskal.com/kalle
^ permalink raw reply
* Re: [PATCH 09/25] Port builtin-add.c to use the new option parser.
From: Michael Witten @ 2007-10-16 9:36 UTC (permalink / raw)
To: Pierre Habouzit; +Cc: git
In-Reply-To: <2209D123-A245-43C4-8DD9-A83386852556@mit.edu>
On 16 Oct 2007, at 4:55:41 AM, Michael Witten wrote:
> On 16 Oct 2007, at 4:39:42 AM, Pierre Habouzit wrote:
>
>> + OPT_BOOLEAN('u', NULL, &take_worktree_changes, "update only
>> files that git already knows about"),
>
> "update only files in the current directory that git already knows
> about"
Better grammar:
"update only files that git already knows about in the current
directory"
^ permalink raw reply
* Re: [PATCH 1/5] Add a generic tree traversal to fetch SVN properties.
From: Benoit SIGOURE @ 2007-10-16 9:35 UTC (permalink / raw)
To: Eric Wong; +Cc: git
In-Reply-To: <20071016074310.GA32254@soma>
[-- Attachment #1: Type: text/plain, Size: 3576 bytes --]
On Oct 16, 2007, at 9:43 AM, Eric Wong wrote:
> Benoit Sigoure <tsuna@lrde.epita.fr> wrote:
>> * git-svn.perl (&traverse_ignore): Remove.
>> (&prop_walk): New.
>> (&cmd_show_ignore): Use prop_walk.
>>
>> Signed-off-by: Benoit Sigoure <tsuna@lrde.epita.fr>
>
> Although I myself have never needed this functionality, this series
> looks pretty good in general.
I heavily script Git with my own wrappers and having this sort if
functionality does enhance the scriptability of git-svn.
>
> Thanks.
You're welcome :)
>
> One comment below about property selection (whitelist vs blacklist).
>
>
> It would be possible to get identical information out of
> unhandled.log,
> but older repositories may not have complete information... Maybe
> some
> local option would be good for people with complete unhandled.log
> files;
> but it could be really incomplete/insufficient.
>
In order to avoid using SVN::Ra and avoid access to the SVN repo?
Hmm, clever, I didn't think about this. Maybe we can provide both,
the default would check unhandled.log and an option would enable
direct access to the SVN repo?
>
> I'm not sure about 5/5, it's purely a style issue, however I don't
> really feel strongly about a trailing "\n" either way...
> Nevertheless,
> it is definitely not part of this series and should be treated
> independently.
>
Indeed.
>
> Coding style
>
> Other than that, I prefer to keep braces on the same line as foreach,
> if, else statements. I generally follow the git and Linux coding
> style for C in my Perl code.
>
> One exception that I make for Perl (but not C) is that I keep the "{"
> for subs on the same line (since subs can be nested and anonymous ones
> passed as arguments and such); unlike their C counterparts[1]
Indeed, sorry, I started correctly but then completely forgot to
follow the existing Coding Style. The CS I use daily is totally
different, sorry ;)
Shall I resend the patch series with corrected CS?
>
> [1] - well, nesting functions is allowed in C99 or GNU C, I can't
> remember which or both...
>
GNU C, AFAIR.
>> ---
>> git-svn.perl | 66 +++++++++++++++++++++++++++++++++++++++
>> +-----------------
>> 1 files changed, 46 insertions(+), 20 deletions(-)
>>
>> diff --git a/git-svn.perl b/git-svn.perl
>> index 777e436..abc83ec 100755
>> --- a/git-svn.perl
>> +++ b/git-svn.perl
[...]
>
> How about having a blacklist (for the author, date, log, uuid?)
> instead
> of a whitelist? I can't remember all of them that should be
> blacklisted,
> but maybe it's just author, date and log)..
>
>> + my $interesting_props = 0;
>> + foreach(keys %{$props})
>> + {
>> + # If it doesn't start with `svn:', it must be a
>> + # user-defined property.
>> + ++$interesting_props and next if $_ !~ /^svn:/;
>> + # FIXME: Fragile, if SVN adds new public properties,
>> + # this needs to be updated.
>> + ++$interesting_props if /^svn:(?:ignore|keywords|executable
>> + |eol-style|mime-type
>> + |externals|needs-lock)$/x;
>> + }
Why not. I thought that the SVN internals were more subject to
change than the public "interface", hence the check.
>> + &$sub($self, $p, $props) if $interesting_props;
>> +
PS: For some reason, the introduction message didn't make its way to
the ML. I made a mistake when sending it because I first ran git
send-email --compose, then noticed that it sent only one mail, and
ran git send-email *.patch afterwards. Weird.
Cheers,
--
Benoit Sigoure aka Tsuna
EPITA Research and Development Laboratory
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 186 bytes --]
^ permalink raw reply
* Re: [PATCH] Make the output of "git svn clone" less confusing.
From: Eric Wong @ 2007-10-16 9:32 UTC (permalink / raw)
To: David Kågedal; +Cc: git
In-Reply-To: <87k5poflp5.fsf@lysator.liu.se>
David Kågedal <davidk@lysator.liu.se> wrote:
> The problem is that the first thing it prints is
>
> Initialized empty Git repository in .git/
>
> even if actually created a subdirectory and changed into it first. But to the
> user, it looks like it is creating a .git/ dir in the directory he/she is
> started git from.
Thanks for bringing it up I just noticed this the other day myself and
thought it might be confusing.
> ---
> git-svn.perl | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> This change makes it more chatty, which might not be a good thing. But
> I think the previous output was worse.
>
> diff --git a/git-svn.perl b/git-svn.perl
> index 777e436..d4450ca 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -286,6 +286,7 @@ sub do_git_init_db {
>
> sub init_subdir {
> my $repo_path = shift or return;
> + print "Creating directory $repo_path\n";
> mkpath([$repo_path]) unless -d $repo_path;
> chdir $repo_path or die "Couldn't chdir to $repo_path: $!\n";
Since mkpath() isn't guaranteed to get called, maybe putting a
print "Entering directory $repo_path\n"
right before the chdir is better.
The other option would be to alter git-init to print the absolute path
of the repository being initialized...
--
Eric Wong
^ permalink raw reply
* Re: [PATCH 09/25] Port builtin-add.c to use the new option parser.
From: Michael Witten @ 2007-10-16 8:55 UTC (permalink / raw)
To: Pierre Habouzit; +Cc: git
In-Reply-To: <1192523998-19474-9-git-send-email-madcoder@debian.org>
On 16 Oct 2007, at 4:39:42 AM, Pierre Habouzit wrote:
> + OPT_BOOLEAN('u', NULL, &take_worktree_changes, "update only files
> that git already knows about"),
"update only files in the current directory that git already knows
about"
^ permalink raw reply
* Re: How to Import a bitkeeper repo into git
From: Marco Costalba @ 2007-10-16 9:11 UTC (permalink / raw)
To: pete; +Cc: Linus Torvalds, VMiklos, free cycle, git
In-Reply-To: <471454B5.7040802@bluelane.com>
On 10/16/07, Pete/Piet Delaney <pete@bluelane.com> wrote:
>
> It's not quite a intuitive/familiar as with bitkeeper. I suspect I just
> need some practice. I selected a huge list if files that we use to
> filter the release with and double clicked on the file I thought showing
> to focus on that file. The I pulled down External Diff and it took for
> ever; like it's confused.
>
You shoudl select only _one_ additional revision.
The currenlty selected revision is the base + select another one
(only) with CTRL + *RIGHT* click (the file list change background
color) , then call external diff tool.
> Often we/I want to see the rev history for a particular file.
> How would you do that with Qgit?
>
Select the file from the file list (right bottom pane) or from the
tree view (use key 't' to toggle treev view) double click on it or use
context menu (right click on the file name) and that's all.
>
> Can I see just the revs for a particular file?
>
See above.
I know I'm going to tell you a very _unpopular_ thing, but, in case
you have 5 minutes of spare time (yes, it doesn't take longer), open
qgit then please press a nice key called 'F1', a nice handbook will
appear...
I really suggest to look at it. To keep UI 'clean' a lot of features
are not immediatly visible, so reading the handbook (at least the
chapter's titiles) would give you a better idea of what qgit could do
for you.
>
> I'll get the latest and greatest. Thinks. Often the problem is
> having the current version of Qt3. My workstation is Mandrake
> 1005 Limited Edition (X11 Xinerama works on this release).
> Looks like I have Qt3 on my workstation. Would it be worthwhile
> to install Qt4 from src and try to use qgit-2.0?
>
Yes it is. There are a lot of new featrures, is almost as stable as
the previous and if you are interested in file history (annotations)
in qgit-2.0 this feature has been greatly speeded up.
Have fun
Marco
^ permalink raw reply
* Re: On Tabs and Spaces
From: Lars Hjemli @ 2007-10-16 9:04 UTC (permalink / raw)
To: Adam Piatyszek; +Cc: Michael Witten, git
In-Reply-To: <471476B7.5050105@users.sourceforge.net>
On 10/16/07, Adam Piatyszek <ediap@users.sourceforge.net> wrote:
> I am kindly asking for some tips on configuring
> Emacs and Vim to follow the rules used for Git and kernel code
> indentation/alignment.
>From http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/CodingStyle;h=7f1730f1a1ae2e9a6f368bdb10ff65f4568863d5;hb=HEAD
(defun linux-c-mode ()
"C mode with adjusted defaults for use with the Linux kernel."
(interactive)
(c-mode)
(c-set-style "K&R")
(setq tab-width 8)
(setq indent-tabs-mode t)
(setq c-basic-offset 8))
And to use this only in a specific directory:
(setq auto-mode-alist (cons '("/usr/src/linux.*/.*\\.[ch]$" . linux-c-mode)
auto-mode-alist))
--
larsh
^ permalink raw reply
* [PATCH] gitweb: Speed up get_projects_list for large source trees
From: Luke Lu @ 2007-10-16 9:04 UTC (permalink / raw)
To: git
In-Reply-To: <vpqlka3sdka.fsf@bauges.imag.fr>
Hi, I've been using git for a month now and loving it. This is my
first ever patch for git using git. I spent sometime to find out why
the project listing is taking 200s, everytime! I guess that gitweb is
mostly used to serve bare repositories, which would never encounter
such problems. It takes .2s, after the patch on my laptop. That's
1000x improvement for me (on Mac OS X 1.4.10.)
__Luke
Signed-off-by: Luke Lu <git@vicaya.com>
---
gitweb/gitweb.perl | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 3064298..a30eef9 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -1509,16 +1509,20 @@ sub git_get_projects_list {
# remove the trailing "/"
$dir =~ s!/+$!!;
my $pfxlen = length("$dir");
+ my $pfxdepth = ($dir =~ tr!/!!);
File::Find::find({
follow_fast => 1, # follow symbolic links
follow_skip => 2, # ignore duplicates
+ no_chdir => 1, # don't chdir into every directory
dangling_symlinks => 0, # ignore dangling symlinks, silently
wanted => sub {
# skip project-list toplevel, if we get it.
return if (m!^[/.]$!);
# only directories can be git repositories
return unless (-d $_);
+ # don't traverse too deep (Find is super slow on os x)
+ return if tr!/!! - $pfxdepth > 2 && ($File::Find::prune = 1);
my $subdir = substr($File::Find::name, $pfxlen + 1);
# we check related file in $projectroot
--
1.5.3.4
^ permalink raw reply related
* Re: should git command and git-command be equivalent?
From: Matthieu Moy @ 2007-10-16 8:55 UTC (permalink / raw)
To: franky; +Cc: git
In-Reply-To: <20071016084800.270917E6F@mail.kooxoo.com>
"franky" <yinping@kooxoo.com> writes:
>> Also, you can use aliases (for example, I type "git st" to do "git
>> status") with "git whatever", but not with "git-whatever" (unless you
>> define the alias in your shell).
> I try "git st", but it complains "git: 'st' is not a git-command".
Sure, I'm talking about aliases, so what I meant is that I had
[alias]
st = status
in ~/.gitconfig.
> Instead, I use gt-beginning abbreviation for some command frequently used
> such as gtci->git-commit, gtco-->git-checkout, gtst-->git-status,
> gtdi->git-diff, gtinit->git-init
>
> So it will be wonderful if I can use "gtinit --bare"
You can't without defining gtinit as a simple-but-not-totally-trivial
wrapper script.
But you can define an alias to init, to enable you to type
$ git --bare i
(that said, it could be a good idea for "git init" to accept --bare as
an option too).
--
Matthieu
^ permalink raw reply
* RE: should git command and git-command be equivalent?
From: franky @ 2007-10-16 8:47 UTC (permalink / raw)
To: 'Matthieu Moy'; +Cc: git
In-Reply-To: <vpqprzfsdo3.fsf@bauges.imag.fr>
> Also, you can use aliases (for example, I type "git st" to do "git
> status") with "git whatever", but not with "git-whatever" (unless you
> define the alias in your shell).
I try "git st", but it complains "git: 'st' is not a git-command".
Instead, I use gt-beginning abbreviation for some command frequently used
such as gtci->git-commit, gtco-->git-checkout, gtst-->git-status,
gtdi->git-diff, gtinit->git-init
So it will be wonderful if I can use "gtinit --bare"
> --
> Matthieu
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 07/25] parse-options: make some arguments optional, add callbacks.
From: Pierre Habouzit @ 2007-10-16 8:45 UTC (permalink / raw)
To: git, Shawn O. Pearce
In-Reply-To: <1192523998-19474-7-git-send-email-madcoder@debian.org>
[-- Attachment #1: Type: text/plain, Size: 647 bytes --]
This bit is to allow to aggregate options with arguments together when
the argument is numeric.
+#if 0
+ /* can be used to understand -A1B1 like -A1 -B1 */
+ if (flag & OPT_SHORT && opt->opt && isdigit(*opt->opt)) {
+ *(int *)opt->value = strtol(opt->opt, (char **)&opt->opt, 10);
+ return 0;
+ }
+#endif
I'm not a huge fan, but people may like it. Feel free to keep the
chunk, drop it, or enable it to your liking.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [parse-options] proposal for merge, take 1
From: Pierre Habouzit @ 2007-10-16 8:43 UTC (permalink / raw)
To: git, Shawn O. Pearce
In-Reply-To: <20071016082010.GD6919@artemis.corp>
[-- Attachment #1: Type: text/plain, Size: 3266 bytes --]
On mar, oct 16, 2007 at 08:20:10 +0000, Pierre Habouzit wrote:
> On mar, oct 16, 2007 at 08:16:31 +0000, Pierre Habouzit wrote:
> > The branch is available from git://git.madism.org/git.git in the topic
> > branch ph/parseopt. I just rebased it onto the last "next" spearce
> > produced.
>
> > Make builtin-pack-objects.c use parse_options.
>
> ERRR DON'T TAKE 25/25, it's WIP and is broken atm, format-patch again
> hasn't DWIM. It is not pushed to git://git.madism.org/git.git btw.
okay I'm wrong, sorry for the alarm, I just generated the --stat and shortlog
too broadly, but 25/25 is definitely OK.
Proper stats for part2 are:
Jonas Fonseca (1):
Update manpages to reflect new short and long option aliases
Kristian Høgsberg (1):
Port builtin-add.c to use the new option parser.
Pierre Habouzit (15):
Make builtin-rm.c use parse_options.
Make builtin-mv.c use parse-options
Make builtin-branch.c use parse_options.
Make builtin-describe.c use parse_options
Make builtin-fetch.c use parse_options.
Make builtin-revert.c use parse_options.
Make builtin-update-ref.c use parse_options
Make builtin-symbolic-ref.c use parse_options.
Make builtin-http-fetch.c use parse_options.
Make builtin-for-each-ref.c use parse-opts.
Make builtin-fsck.c use parse_options.
Make builtin-count-objects.c use parse_options.
Make builtin-name-rev.c use parse_options.
Make builtin-pack-refs.c use parse_options.
Make builtin-show-ref.c use parse_options [small backward incompatibility].
Documentation/git-add.txt | 4 +-
Documentation/git-branch.txt | 2 +-
Documentation/git-mv.txt | 2 +-
Documentation/git-rm.txt | 4 +-
Documentation/git-show-ref.txt | 4 +-
Documentation/git-symbolic-ref.txt | 2 +-
builtin-add.c | 70 ++++++-----------
builtin-branch.c | 147 +++++++++++++-----------------------
builtin-count-objects.c | 32 ++++----
builtin-describe.c | 70 +++++++----------
builtin-fetch.c | 146 ++++++++++++------------------------
builtin-for-each-ref.c | 138 +++++++++++++++-------------------
builtin-fsck.c | 80 ++++++-------------
builtin-http-fetch.c | 65 +++++++---------
builtin-mv.c | 84 +++++++++------------
builtin-name-rev.c | 64 ++++++----------
builtin-pack-refs.c | 47 +++++-------
builtin-revert.c | 67 +++++++---------
builtin-rm.c | 54 ++++++--------
builtin-show-ref.c | 127 +++++++++++--------------------
builtin-symbolic-ref.c | 52 +++++--------
builtin-update-ref.c | 65 ++++++----------
22 files changed, 515 insertions(+), 811 deletions(-)
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: Is there any plan to support partial checkout or submoudule improvement?
From: Lars Hjemli @ 2007-10-16 8:42 UTC (permalink / raw)
To: franky; +Cc: git
In-Reply-To: <20071016082720.E5EDA7E6F@mail.kooxoo.com>
On 10/16/07, franky <yinping@kooxoo.com> wrote:
> I want a single "git-pull" to deploy a new version and a
> single "git-reset" to back to versions before
Well, there is always
$ git archive --remote=<repo> <revspec> <path> | tar -x
This is effectively a partial checkout of an arbitrary revision from a
remote repo.
--
larsh
^ permalink raw reply
* Re: On Tabs and Spaces
From: Adam Piatyszek @ 2007-10-16 8:30 UTC (permalink / raw)
To: Michael Witten; +Cc: git
In-Reply-To: <634393B0-734A-4884-93E3-42F7D3CB157F@mit.edu>
* Michael Witten [16 X 2007 08:45]:
> What are the rules about tabs and spaces in source code?
Following this topic, I am kindly asking for some tips on configuring
Emacs and Vim to follow the rules used for Git and kernel code
indentation/alignment.
Thanks in advance!
BR,
/Adam
--
.:. Adam Piatyszek - "ediap" .:. JID: ediap(at)jabber.org .:.
.:. ediap(at)users.sourceforge.net .:. PGP key ID: 0x1F115CCB .:.
^ permalink raw reply
* RE: Is there any plan to support partial checkout or submoudule improvement?
From: franky @ 2007-10-16 8:27 UTC (permalink / raw)
To: 'Lars Hjemli'; +Cc: git
In-Reply-To: <8c5c35580710160108s4faeaa61k7585d01703c0c8fc@mail.gmail.com>
It works. However, I want a single "git-pull" to deploy a new version and a
single "git-reset" to back to versions before. So I need another resolution.
franky
-----Original Message-----
From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On Behalf
Of Lars Hjemli
Sent: Tuesday, October 16, 2007 4:08 PM
To: franky
Cc: git@vger.kernel.org
Subject: Re: Is there any plan to support partial checkout or submoudule
improvement?
On 10/16/07, franky <yinping@kooxoo.com> wrote:
> 2. src, bin not submoudle, just sub directory
> When src changes, compiled binaries are still put in bin
directory.
> However, only one commit is required. Perfect? No, another problem when
> deploying. I don't want the src directory to appear in the deployment
> directory.
If this is just for deployment of your bin directory, you can try
$ cd Project/bin
$ git archive --prefix='Project/bin/' HEAD | gzip > Project-x.y.tar.gz
--
larsh
^ permalink raw reply
* Re: [parse-options] proposal for merge, take 1
From: Pierre Habouzit @ 2007-10-16 8:20 UTC (permalink / raw)
To: git, Shawn O. Pearce
In-Reply-To: <1192522616-16274-1-git-send-email-madcoder@debian.org>
[-- Attachment #1: Type: text/plain, Size: 603 bytes --]
On mar, oct 16, 2007 at 08:16:31 +0000, Pierre Habouzit wrote:
> The branch is available from git://git.madism.org/git.git in the topic
> branch ph/parseopt. I just rebased it onto the last "next" spearce
> produced.
> Make builtin-pack-objects.c use parse_options.
ERRR DON'T TAKE 25/25, it's WIP and is broken atm, format-patch again
hasn't DWIM. It is not pushed to git://git.madism.org/git.git btw.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* [parse-options] proposal for merge, take 1
From: Pierre Habouzit @ 2007-10-16 8:16 UTC (permalink / raw)
To: git, Shawn O. Pearce
Hi, thanks to the tremendous help I received from Dscho to make its
API and internals even better, I believe that my parseopt branch is
ready for inclusion.
There is only _one_ small backward incompatibility (if other ones,
then it's not done on purpose and should be fixed) in git-show-ref: it
had a -h short option, synonym of --head. I made this -H because -h is
automatically diverted to "show usage" now, and it's counter-intuitive
anyways. I rebased -i my series so that this patch comes last if people
think it's a bad idea, so that the rest can be still be merged.
Note that patch 7/25 has a small discussion in it.
The series comes in 2 parts: the parse-options construction, split
into small pieces to introduce each feature. And the migration of a few
builtins. Diffstats and shortlogs follow.
The branch is available from git://git.madism.org/git.git in the topic
branch ph/parseopt. I just rebased it onto the last "next" spearce
produced.
Thanks to Alex Riesen, Johannes Schindelin, Jonas Fonseca and Kristian
Høgsberg for their help, patches and advices.
==============================================================================
Part 1
------------------------------------------------------------------------------
Alex Riesen (1):
Rework make_usage to print the usage message immediately
Johannes Schindelin (2):
Add tests for parse-options.c
parse-options: Allow abbreviated options when unambiguous
Pierre Habouzit (5):
Add a simple option parser.
parse-options: be able to generate usages automatically
Add shortcuts for very often used options.
parse-options: make some arguments optional, add callbacks.
parse-options: allow callbacks to take no arguments at all.
.gitignore | 1 +
Makefile | 6 +-
parse-options.c | 328 ++++++++++++++++++++++++++++++++++++++++++++++
parse-options.h | 70 ++++++++++
t/t0040-parse-options.sh | 92 +++++++++++++
test-parse-options.c | 35 +++++
6 files changed, 529 insertions(+), 3 deletions(-)
==============================================================================
Part 2
------------------------------------------------------------------------------
Jonas Fonseca (1):
Update manpages to reflect new short and long option aliases
Kristian Høgsberg (1):
Port builtin-add.c to use the new option parser.
Pierre Habouzit (16):
Make builtin-rm.c use parse_options.
Make builtin-mv.c use parse-options
Make builtin-branch.c use parse_options.
Make builtin-describe.c use parse_options
Make builtin-fetch.c use parse_options.
Make builtin-revert.c use parse_options.
Make builtin-update-ref.c use parse_options
Make builtin-symbolic-ref.c use parse_options.
Make builtin-http-fetch.c use parse_options.
Make builtin-for-each-ref.c use parse-opts.
Make builtin-fsck.c use parse_options.
Make builtin-count-objects.c use parse_options.
Make builtin-name-rev.c use parse_options.
Make builtin-pack-refs.c use parse_options.
Make builtin-show-ref.c use parse_options [small backward incompatibility].
Make builtin-pack-objects.c use parse_options.
Documentation/git-add.txt | 4 +-
Documentation/git-branch.txt | 2 +-
Documentation/git-mv.txt | 2 +-
Documentation/git-rm.txt | 4 +-
Documentation/git-show-ref.txt | 4 +-
Documentation/git-symbolic-ref.txt | 2 +-
builtin-add.c | 70 +++------
builtin-branch.c | 147 +++++++------------
builtin-count-objects.c | 32 ++--
builtin-describe.c | 70 ++++-----
builtin-fetch.c | 146 ++++++------------
builtin-for-each-ref.c | 138 ++++++++----------
builtin-fsck.c | 80 +++-------
builtin-http-fetch.c | 65 ++++-----
builtin-mv.c | 84 +++++------
builtin-name-rev.c | 64 +++-----
builtin-pack-objects.c | 294 +++++++++++++++++-------------------
builtin-pack-refs.c | 47 +++----
builtin-revert.c | 67 ++++-----
builtin-rm.c | 54 +++----
builtin-show-ref.c | 127 ++++++----------
builtin-symbolic-ref.c | 52 +++----
builtin-update-ref.c | 65 +++-----
23 files changed, 654 insertions(+), 966 deletions(-)
^ permalink raw reply
* Re: Is there any plan to support partial checkout or submoudule improvement?
From: Lars Hjemli @ 2007-10-16 8:08 UTC (permalink / raw)
To: franky; +Cc: git
In-Reply-To: <20071016032048.771557E80@mail.kooxoo.com>
On 10/16/07, franky <yinping@kooxoo.com> wrote:
> 2. src, bin not submoudle, just sub directory
> When src changes, compiled binaries are still put in bin directory.
> However, only one commit is required. Perfect? No, another problem when
> deploying. I don't want the src directory to appear in the deployment
> directory.
If this is just for deployment of your bin directory, you can try
$ cd Project/bin
$ git archive --prefix='Project/bin/' HEAD | gzip > Project-x.y.tar.gz
--
larsh
^ permalink raw reply
* Re: git-fast-import crashes
From: Pierre Habouzit @ 2007-10-16 8:04 UTC (permalink / raw)
To: Shun Kei Leung; +Cc: git, Shawn O. Pearce
In-Reply-To: <e66701d40710160101x5c697a6fmeecea4c81dfd9972@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1045 bytes --]
On Tue, Oct 16, 2007 at 08:01:18AM +0000, Shun Kei Leung wrote:
> > What I _really_ need is that you run your test into valgrind (the easy
> > way is to rename git-fast-import into git-fast-import.bin, and make
> > git-fast-import be a shell-script doing:
> ....
>
> valgrind is not yet ported to Mac OS X, sadly enough.
hmmm I see. hmmm isn't there _any_ chance that you can have access to
a linux box to see if that fails in the same conditions ? I mean I
believe qemu (or virtual pc or …) on your macos would be just fine.
But this realloc() that returns 0xd looks fishy. I would be tempted to
think of a stack corruption, but the frame just before still looks
correct so I'm confused. And valgrind is definitely the tool to use for
stack smashing and other memory related corruptions :/
Using gcc -Wstack-protector may also help.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: git-fast-import crashes
From: Shun Kei Leung @ 2007-10-16 8:01 UTC (permalink / raw)
To: Pierre Habouzit, Shun Kei Leung, git, Shawn O. Pearce
In-Reply-To: <20071016074645.GA6919@artemis.corp>
> What I _really_ need is that you run your test into valgrind (the easy
> way is to rename git-fast-import into git-fast-import.bin, and make
> git-fast-import be a shell-script doing:
...
valgrind is not yet ported to Mac OS X, sadly enough.
Regards,
Kevin Leung
^ 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