Merge branch 'maint'
authorJunio C Hamano <junkio@cox.net>
Wed, 28 Feb 2007 22:18:57 +0000 (14:18 -0800)
committerJunio C Hamano <junkio@cox.net>
Wed, 28 Feb 2007 22:18:57 +0000 (14:18 -0800)
* maint:
Start preparing Release Notes for 1.5.0.3
Documentation: git-remote add [-t <branch>] [-m <branch>] [-f] name url
Include config.mak in doc/Makefile
git.el: Set the default commit coding system from the repository config.
git-archimport: support empty summaries, put summary on a single line.
http-push.c::lock_remote(): validate all remote refs.
git-cvsexportcommit: don't cleanup .msg if not yet committed to cvs.

1  2 
Documentation/git-remote.txt
git-cvsexportcommit.perl
http-push.c
index 266faade31ae646a419616fc0fce9d676f112d9d,f96b30429c8d970a2eaabe4a1f3b162ce48a9cee..a9fb6a9a5ef3cfeffa37578b4d703ca75c73f306
@@@ -10,10 -10,9 +10,10 @@@ SYNOPSI
  --------
  [verse]
  'git-remote'
- 'git-remote' add <name> <url>
+ 'git-remote' add [-t <branch>] [-m <branch>] [-f] <name> <url>
  'git-remote' show <name>
  'git-remote' prune <name>
 +'git-remote' update [group]
  
  DESCRIPTION
  -----------
@@@ -54,17 -53,7 +54,17 @@@ Gives some information about the remot
  
  Deletes all stale tracking branches under <name>.
  These stale branches have already been removed from the remote repository
 -referenced by <name>, but are still locally available in "remotes/<name>".
 +referenced by <name>, but are still locally available in
 +"remotes/<name>".
 +
 +'update'::
 +
 +Fetch updates for a named set of remotes in the repository as defined by
 +remotes.<group>.  If a named group is not specified on the command line,
 +the configuration parameter remotes.default will get used; if
 +remotes.default is not defined, all remotes which do not the
 +configuration parameter remote.<name>.skipDefaultUpdate set to true will
 +be updated.  (See gitlink:git-config[1]).
  
  
  DISCUSSION
@@@ -77,8 -66,8 +77,8 @@@ gitlink:git-config[1])
  Examples
  --------
  
- Add a new remote, fetch, and check out a branch from it:
+ * Add a new remote, fetch, and check out a branch from it
+ +
  ------------
  $ git remote
  origin
@@@ -98,6 -87,17 +98,17 @@@ $ git checkout -b nfs linux-nfs/maste
  ...
  ------------
  
+ * Imitate 'git clone' but track only selected branches
+ +
+ ------------
+ $ mkdir project.git
+ $ cd project.git
+ $ git init
+ $ git remote add -f -t master -m master origin git://example.com/git.git/
+ $ git merge origin
+ ------------
  See Also
  --------
  gitlink:git-fetch[1]
diff --combined git-cvsexportcommit.perl
index d08216cfd7df47310e6eee155520d600a561d467,32a488332122e005bd5007a23111eac1093b940a..67224b44497715edc07df9d7df469339caa48e51
@@@ -15,21 -15,14 +15,21 @@@ unless ($ENV{GIT_DIR} && -r $ENV{GIT_DI
      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 );
 +our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m, $opt_d);
  
 -getopts('hPpvcfam:');
 +getopts('hPpvcfam:d:');
  
  $opt_h && usage();
  
  die "Need at least one commit identifier!" unless @ARGV;
  
 +my @cvs;
 +if ($opt_d) {
 +      @cvs = ('cvs', '-d', $opt_d);
 +} else {
 +      @cvs = ('cvs');
 +}
 +
  # setup a tempdir
  our ($tmpdir, $tmpdirname) = tempdir('git-cvsapplycommit-XXXXXX',
                                     TMPDIR => 1,
@@@ -167,7 -160,7 +167,7 @@@ foreach my $f (@afiles) 
        my $p = $1;
        next if (grep { $_ eq $p } @dirs);
      }
 -    my @status = grep(m/^File/,  safe_pipe_capture('cvs', '-q', 'status' ,$f));
 +    my @status = grep(m/^File/,  safe_pipe_capture(@cvs, '-q', 'status' ,$f));
      if (@status > 1) { warn 'Strange! cvs status returned more than one line?'};
      if (-d dirname $f and $status[0] !~ m/Status: Unknown$/
        and $status[0] !~ m/^File: no file /) {
  foreach my $f (@files) {
      next if grep { $_ eq $f } @afiles;
      # TODO:we need to handle removed in cvs
 -    my @status = grep(m/^File/,  safe_pipe_capture('cvs', '-q', 'status' ,$f));
 +    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: Up-to-date$/) {
        $dirty = 1;
@@@ -201,7 -194,7 +201,7 @@@ 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)) {
 +    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);
 +      system(@cvs, 'add','-kb',$f);
      } else {
 -      system('cvs', 'add', $f);
 +      system(@cvs, 'add', $f);
      }
      if ($?) {
        $dirtypatch = 1;
  }
  
  foreach my $f (@dfiles) {
 -    system('cvs', 'rm', '-f', $f);
 +    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";
  print "Patch title (first comment line): $title\n";
  my @commitfiles = map { unless (m/\s/) { '\''.$_.'\''; } else { $_; }; } (@files);
 -my $cmd = "cvs commit -F .msg @commitfiles";
 +my $cmd = join(' ', @cvs)." commit -F .msg @commitfiles";
  
  if ($dirtypatch) {
      print "NOTE: One or more hunks failed to apply cleanly.\n";
  
  if ($opt_c) {
      print "Autocommit\n  $cmd\n";
 -    print safe_pipe_capture('cvs', 'commit', '-F', '.msg', @files);
 +    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";
  }
  
  # clean up
  unlink(".cvsexportcommit.diff");
- unlink(".msg");
  
  sub usage {
        print STDERR <<END;
diff --combined http-push.c
index 0fd73dbf587559a7245a56240259de96638434b3,cec7bf7fad9ccabc55d4e72c8dfb6bbe0ad3a1be..68b78b538ad42bce99dce690bc40ea85c1ed2377
@@@ -479,7 -479,7 +479,7 @@@ static void start_put(struct transfer_r
        char *hex = sha1_to_hex(request->obj->sha1);
        struct active_request_slot *slot;
        char *posn;
 -      char type[20];
 +      enum object_type type;
        char hdr[50];
        void *unpacked;
        unsigned long len;
        ssize_t size;
        z_stream stream;
  
 -      unpacked = read_sha1_file(request->obj->sha1, type, &len);
 -      hdrlen = sprintf(hdr, "%s %lu", type, len) + 1;
 +      unpacked = read_sha1_file(request->obj->sha1, &type, &len);
 +      hdrlen = sprintf(hdr, "%s %lu", typename(type), len) + 1;
  
        /* Set it up */
        memset(&stream, 0, sizeof(stream));
@@@ -1060,8 -1060,8 +1060,8 @@@ static int fetch_indices(void
                case 'P':
                        i++;
                        if (i + 52 < buffer.posn &&
 -                          !strncmp(data + i, " pack-", 6) &&
 -                          !strncmp(data + i + 46, ".pack\n", 6)) {
 +                          !prefixcmp(data + i, " pack-") &&
 +                          !prefixcmp(data + i + 46, ".pack\n")) {
                                get_sha1_hex(data + i + 6, sha1);
                                setup_index(sha1);
                                i += 51;
@@@ -1206,11 -1206,11 +1206,11 @@@ static void handle_new_lock_ctx(struct 
                        lock->owner = xmalloc(strlen(ctx->cdata) + 1);
                        strcpy(lock->owner, ctx->cdata);
                } else if (!strcmp(ctx->name, DAV_ACTIVELOCK_TIMEOUT)) {
 -                      if (!strncmp(ctx->cdata, "Second-", 7))
 +                      if (!prefixcmp(ctx->cdata, "Second-"))
                                lock->timeout =
                                        strtol(ctx->cdata + 7, NULL, 10);
                } else if (!strcmp(ctx->name, DAV_ACTIVELOCK_TOKEN)) {
 -                      if (!strncmp(ctx->cdata, "opaquelocktoken:", 16)) {
 +                      if (!prefixcmp(ctx->cdata, "opaquelocktoken:")) {
                                lock->token = xmalloc(strlen(ctx->cdata) - 15);
                                strcpy(lock->token, ctx->cdata + 16);
                        }
@@@ -1295,7 -1295,7 +1295,7 @@@ static struct remote_lock *lock_remote(
        sprintf(url, "%s%s", remote->url, path);
  
        /* Make sure leading directories exist for the remote ref */
-       ep = strchr(url + strlen(remote->url) + 11, '/');
+       ep = strchr(url + strlen(remote->url) + 1, '/');
        while (ep) {
                *ep = 0;
                slot = get_active_slot();
@@@ -2168,7 -2168,7 +2168,7 @@@ static void fetch_symref(const char *pa
                return;
  
        /* If it's a symref, set the refname; otherwise try for a sha1 */
 -      if (!strncmp((char *)buffer.buffer, "ref: ", 5)) {
 +      if (!prefixcmp((char *)buffer.buffer, "ref: ")) {
                *symref = xmalloc(buffer.posn - 5);
                strlcpy(*symref, (char *)buffer.buffer + 5, buffer.posn - 5);
        } else {