]> asedeno.scripts.mit.edu Git - git.git/blobdiff - revision.c
Fix make_absolute_path() for parameters without a slash
[git.git] / revision.c
index 5df7961c501488a5393fd65de5de4bcf2eac1c25..0eb6faa5378ebafe2c4939cb4ec7fd2e6aaadb02 100644 (file)
@@ -633,12 +633,13 @@ static int handle_one_ref(const char *path, const unsigned char *sha1, int flag,
        return 0;
 }
 
-static void handle_all(struct rev_info *revs, unsigned flags)
+static void handle_refs(struct rev_info *revs, unsigned flags,
+               int (*for_each)(each_ref_fn, void *))
 {
        struct all_refs_cb cb;
        cb.all_revs = revs;
        cb.all_flags = flags;
-       for_each_ref(handle_one_ref, &cb);
+       for_each(handle_one_ref, &cb);
 }
 
 static void handle_one_reflog_commit(unsigned char *sha1, void *cb_data)
@@ -738,6 +739,10 @@ void init_revisions(struct rev_info *revs, const char *prefix)
        revs->commit_format = CMIT_FMT_DEFAULT;
 
        diff_setup(&revs->diffopt);
+       if (prefix && !revs->diffopt.prefix) {
+               revs->diffopt.prefix = prefix;
+               revs->diffopt.prefix_length = strlen(prefix);
+       }
 }
 
 static void add_pending_commit_list(struct rev_info *revs,
@@ -1011,7 +1016,19 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
                                continue;
                        }
                        if (!strcmp(arg, "--all")) {
-                               handle_all(revs, flags);
+                               handle_refs(revs, flags, for_each_ref);
+                               continue;
+                       }
+                       if (!strcmp(arg, "--branches")) {
+                               handle_refs(revs, flags, for_each_branch_ref);
+                               continue;
+                       }
+                       if (!strcmp(arg, "--tags")) {
+                               handle_refs(revs, flags, for_each_tag_ref);
+                               continue;
+                       }
+                       if (!strcmp(arg, "--remotes")) {
+                               handle_refs(revs, flags, for_each_remote_ref);
                                continue;
                        }
                        if (!strcmp(arg, "--first-parent")) {