* maint:
  pager: default to LESS=FRSX not LESS=FRS
  Make prune also run prune-packed
  git-vc: better installation instructions
  gitweb: Do not esc_html $basedir argument to git_print_tree_entry
  gitweb: Whitespace cleanup - tabs are for indent, spaces are for align (2)
  Fix usagestring for git-branch
  git-merge: show usage if run without arguments
This commit is contained in:
Junio C Hamano 2006-10-22 22:40:30 -07:00
Родитель 87b787ac77 0abc0260fa
Коммит 02a20456d2
8 изменённых файлов: 52 добавлений и 42 удалений

Просмотреть файл

@ -4,9 +4,7 @@
static const char prune_packed_usage[] =
"git-prune-packed [-n]";
static int dryrun;
static void prune_dir(int i, DIR *dir, char *pathname, int len)
static void prune_dir(int i, DIR *dir, char *pathname, int len, int dryrun)
{
struct dirent *de;
char hex[40];
@ -31,7 +29,7 @@ static void prune_dir(int i, DIR *dir, char *pathname, int len)
rmdir(pathname);
}
static void prune_packed_objects(void)
void prune_packed_objects(int dryrun)
{
int i;
static char pathname[PATH_MAX];
@ -50,7 +48,7 @@ static void prune_packed_objects(void)
d = opendir(pathname);
if (!d)
continue;
prune_dir(i, d, pathname, len + 3);
prune_dir(i, d, pathname, len + 3, dryrun);
closedir(d);
}
}
@ -58,6 +56,7 @@ static void prune_packed_objects(void)
int cmd_prune_packed(int argc, const char **argv, const char *prefix)
{
int i;
int dryrun;
for (i = 1; i < argc; i++) {
const char *arg = argv[i];
@ -73,6 +72,6 @@ int cmd_prune_packed(int argc, const char **argv, const char *prefix)
usage(prune_packed_usage);
}
sync();
prune_packed_objects();
prune_packed_objects(dryrun);
return 0;
}

Просмотреть файл

@ -255,5 +255,7 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
prune_object_dir(get_object_directory());
sync();
prune_packed_objects(show_only);
return 0;
}

Просмотреть файл

@ -11,6 +11,7 @@ extern int mailinfo(FILE *in, FILE *out, int ks, const char *encoding, const cha
extern int split_mbox(const char **mbox, const char *dir, int allow_bare, int nr_prec, int skip);
extern void stripspace(FILE *in, FILE *out);
extern int write_tree(unsigned char *sha1, int missing_ok, const char *prefix);
extern void prune_packed_objects(int);
extern int cmd_add(int argc, const char **argv, const char *prefix);
extern int cmd_apply(int argc, const char **argv, const char *prefix);

Просмотреть файл

@ -23,7 +23,10 @@
;; system.
;;
;; To install: put this file on the load-path and add GIT to the list
;; of supported backends in `vc-handled-backends'.
;; of supported backends in `vc-handled-backends'; the following line,
;; placed in your ~/.emacs, will accomplish this:
;;
;; (add-to-list 'vc-handled-backends 'GIT)
;;
;; TODO
;; - changelog generation

Просмотреть файл

@ -1,6 +1,6 @@
#!/bin/sh
USAGE='[-l] [(-d | -D) <branchname>] | [[-f] <branchname> [<start-point>]] | -r'
USAGE='[-l] [-f] <branchname> [<start-point>] | (-d | -D) <branchname> | [-r]'
LONG_USAGE='If no arguments, show available branches and mark current branch with a star.
If one argument, create a new branch <branchname> based off of current HEAD.
If two arguments, create a new branch <branchname> based off of <start-point>.'

Просмотреть файл

@ -93,6 +93,8 @@ finish () {
esac
}
case "$#" in 0) usage ;; esac
rloga=
while case "$#" in 0) break ;; esac
do

Просмотреть файл

@ -1722,13 +1722,13 @@ sub git_print_tree_entry {
if ($t->{'type'} eq "blob") {
print "<td class=\"list\">" .
$cgi->a({-href => href(action=>"blob", hash=>$t->{'hash'},
file_name=>"$basedir$t->{'name'}", %base_key),
-class => "list"}, esc_html($t->{'name'})) . "</td>\n";
file_name=>"$basedir$t->{'name'}", %base_key),
-class => "list"}, esc_html($t->{'name'})) . "</td>\n";
print "<td class=\"link\">";
if ($have_blame) {
print $cgi->a({-href => href(action=>"blame", hash=>$t->{'hash'},
file_name=>"$basedir$t->{'name'}", %base_key)},
"blame");
file_name=>"$basedir$t->{'name'}", %base_key)},
"blame");
}
if (defined $hash_base) {
if ($have_blame) {
@ -1740,8 +1740,8 @@ sub git_print_tree_entry {
}
print " | " .
$cgi->a({-href => href(action=>"blob_plain", hash_base=>$hash_base,
file_name=>"$basedir$t->{'name'}")},
"raw");
file_name=>"$basedir$t->{'name'}")},
"raw");
print "</td>\n";
} elsif ($t->{'type'} eq "tree") {
@ -1809,7 +1809,7 @@ sub git_difftree_body {
print "<td>";
print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
hash_base=>$hash, file_name=>$diff{'file'}),
-class => "list"}, esc_html($diff{'file'}));
-class => "list"}, esc_html($diff{'file'}));
print "</td>\n";
print "<td>$mode_chng</td>\n";
print "<td class=\"link\">";
@ -1836,11 +1836,11 @@ sub git_difftree_body {
print " | ";
}
print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
file_name=>$diff{'file'})},
"blame") . " | ";
file_name=>$diff{'file'})},
"blame") . " | ";
print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
file_name=>$diff{'file'})},
"history");
file_name=>$diff{'file'})},
"history");
print "</td>\n";
} elsif ($diff{'status'} eq "M" || $diff{'status'} eq "T") { # modified, or type changed
@ -1861,8 +1861,8 @@ sub git_difftree_body {
}
print "<td>";
print $cgi->a({-href => href(action=>"blob", hash=>$diff{'to_id'},
hash_base=>$hash, file_name=>$diff{'file'}),
-class => "list"}, esc_html($diff{'file'}));
hash_base=>$hash, file_name=>$diff{'file'}),
-class => "list"}, esc_html($diff{'file'}));
print "</td>\n";
print "<td>$mode_chnge</td>\n";
print "<td class=\"link\">";
@ -1873,19 +1873,19 @@ sub git_difftree_body {
print $cgi->a({-href => "#patch$patchno"}, "patch");
} else {
print $cgi->a({-href => href(action=>"blobdiff",
hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
hash_base=>$hash, hash_parent_base=>$parent,
file_name=>$diff{'file'})},
"diff");
hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
hash_base=>$hash, hash_parent_base=>$parent,
file_name=>$diff{'file'})},
"diff");
}
print " | ";
}
print $cgi->a({-href => href(action=>"blame", hash_base=>$hash,
file_name=>$diff{'file'})},
"blame") . " | ";
file_name=>$diff{'file'})},
"blame") . " | ";
print $cgi->a({-href => href(action=>"history", hash_base=>$hash,
file_name=>$diff{'file'})},
"history");
file_name=>$diff{'file'})},
"history");
print "</td>\n";
} elsif ($diff{'status'} eq "R" || $diff{'status'} eq "C") { # renamed or copied
@ -1913,19 +1913,19 @@ sub git_difftree_body {
print $cgi->a({-href => "#patch$patchno"}, "patch");
} else {
print $cgi->a({-href => href(action=>"blobdiff",
hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
hash_base=>$hash, hash_parent_base=>$parent,
file_name=>$diff{'to_file'}, file_parent=>$diff{'from_file'})},
"diff");
hash=>$diff{'to_id'}, hash_parent=>$diff{'from_id'},
hash_base=>$hash, hash_parent_base=>$parent,
file_name=>$diff{'to_file'}, file_parent=>$diff{'from_file'})},
"diff");
}
print " | ";
}
print $cgi->a({-href => href(action=>"blame", hash_base=>$parent,
file_name=>$diff{'from_file'})},
"blame") . " | ";
file_name=>$diff{'from_file'})},
"blame") . " | ";
print $cgi->a({-href => href(action=>"history", hash_base=>$parent,
file_name=>$diff{'from_file'})},
"history");
file_name=>$diff{'from_file'})},
"history");
print "</td>\n";
} # we should not encounter Unmerged (U) or Unknown (X) status
@ -2834,7 +2834,7 @@ sub git_tree {
my $refs = git_get_references();
my $ref = format_ref_marker($refs, $hash_base);
git_header_html();
my $base = "";
my $basedir = '';
my ($have_blame) = gitweb_check_feature('blame');
if (defined $hash_base && (my %co = parse_commit($hash_base))) {
my @views_nav = ();
@ -2851,7 +2851,7 @@ sub git_tree {
# FIXME: Should be available when we have no hash base as well.
push @views_nav,
$cgi->a({-href => href(action=>"snapshot", hash=>$hash)},
"snapshot");
"snapshot");
}
git_print_page_nav('tree','', $hash_base, undef, undef, join(' | ', @views_nav));
git_print_header_div('commit', esc_html($co{'title'}) . $ref, $hash_base);
@ -2862,7 +2862,10 @@ sub git_tree {
print "<div class=\"title\">$hash</div>\n";
}
if (defined $file_name) {
$base = esc_html("$file_name/");
$basedir = $file_name;
if ($basedir ne '' && substr($basedir, -1) ne '/') {
$basedir .= '/';
}
}
git_print_page_path($file_name, 'tree', $hash_base);
print "<div class=\"page_body\">\n";
@ -2878,7 +2881,7 @@ sub git_tree {
}
$alternate ^= 1;
git_print_tree_entry(\%t, $base, $hash_base, $have_blame);
git_print_tree_entry(\%t, $basedir, $hash_base, $have_blame);
print "</tr>\n";
}

Просмотреть файл

@ -50,7 +50,7 @@ void setup_pager(void)
close(fd[0]);
close(fd[1]);
setenv("LESS", "FRS", 0);
setenv("LESS", "FRSX", 0);
run_pager(pager);
die("unable to execute pager '%s'", pager);
exit(255);