Merge branch 'pw/message-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Wed, 2 May 2012 20:53:35 +0000 (13:53 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 May 2012 20:53:35 +0000 (13:53 -0700)
Many error/warning messages had extra trailing newlines that are
unnecessary.

By Pete Wyckoff
* pw/message-cleanup:
remove blank filename in error message
remove superfluous newlines in error messages

1  2 
builtin/branch.c
unpack-trees.c
diff --combined builtin/branch.c
index 8813d2e31c4097934c519c0757415c1ee6fd1f62,dc353ffe6590a12096c3add5ac6facd2c95424a9..f12b626a0ece679cd18a77345c3591b15d5f6cbc
@@@ -152,22 -152,21 +152,22 @@@ static int delete_branches(int argc, co
        struct commit *rev, *head_rev = NULL;
        unsigned char sha1[20];
        char *name = NULL;
 -      const char *fmt, *remote;
 +      const char *fmt;
        int i;
        int ret = 0;
 +      int remote_branch = 0;
        struct strbuf bname = STRBUF_INIT;
  
        switch (kinds) {
        case REF_REMOTE_BRANCH:
                fmt = "refs/remotes/%s";
 -              /* TRANSLATORS: This is "remote " in "remote branch '%s' not found" */
 -              remote = _("remote ");
 +              /* For subsequent UI messages */
 +              remote_branch = 1;
 +
                force = 1;
                break;
        case REF_LOCAL_BRANCH:
                fmt = "refs/heads/%s";
 -              remote = "";
                break;
        default:
                die(_("cannot use -a with -d"));
  
                name = xstrdup(mkpath(fmt, bname.buf));
                if (read_ref(name, sha1)) {
 -                      error(_("%sbranch '%s' not found."),
 -                                      remote, bname.buf);
 +                      error(remote_branch
 +                            ? _("remote branch '%s' not found.")
 +                            : _("branch '%s' not found."), bname.buf);
                        ret = 1;
                        continue;
                }
                }
  
                if (delete_ref(name, sha1, 0)) {
 -                      error(_("Error deleting %sbranch '%s'"), remote,
 +                      error(remote_branch
 +                            ? _("Error deleting remote branch '%s'")
 +                            : _("Error deleting branch '%s'"),
                              bname.buf);
                        ret = 1;
                } else {
                        struct strbuf buf = STRBUF_INIT;
                        if (!quiet)
 -                              printf(_("Deleted %sbranch %s (was %s).\n"),
 -                                     remote, bname.buf,
 +                              printf(remote_branch
 +                                     ? _("Deleted remote branch %s (was %s).\n")
 +                                     : _("Deleted branch %s (was %s).\n"),
 +                                     bname.buf,
                                       find_unique_abbrev(sha1, DEFAULT_ABBREV));
                        strbuf_addf(&buf, "branch.%s", bname.buf);
                        if (git_config_rename_section(buf.buf, NULL) < 0)
@@@ -663,7 -657,7 +663,7 @@@ static int edit_branch_description(cons
        fp = fopen(git_path(edit_description), "w");
        if ((fwrite(buf.buf, 1, buf.len, fp) < buf.len) || fclose(fp)) {
                strbuf_release(&buf);
-               return error(_("could not write branch description template: %s\n"),
+               return error(_("could not write branch description template: %s"),
                             strerror(errno));
        }
        strbuf_reset(&buf);
diff --combined unpack-trees.c
index 1d7393d84c7ca1506108495f4dd17233a5af7324,7cfa026b1a554cf915ac6c73b10d3f7f3713930c..bcee99c52e3a9ee8d67f70c577e57bbde8a8b610
@@@ -1027,7 -1027,6 +1027,7 @@@ int unpack_trees(unsigned len, struct t
        o->result.initialized = 1;
        o->result.timestamp.sec = o->src_index->timestamp.sec;
        o->result.timestamp.nsec = o->src_index->timestamp.nsec;
 +      o->result.version = o->src_index->version;
        o->merge_size = len;
        mark_all_ce_unused(o->src_index);
  
@@@ -1793,7 -1792,7 +1793,7 @@@ int bind_merge(struct cache_entry **src
        struct cache_entry *a = src[1];
  
        if (o->merge_size != 1)
-               return error("Cannot do a bind merge of %d trees\n",
+               return error("Cannot do a bind merge of %d trees",
                             o->merge_size);
        if (a && old)
                return o->gently ? -1 :