42
static int reference_excluded_commits;
43
static int show_original_ids;
44
static int mark_tags;
45
-static struct string_list extra_refs = STRING_LIST_INIT_NODUP;
46
-static struct string_list tag_refs = STRING_LIST_INIT_NODUP;
45
+static struct string_list extra_refs = STRING_LIST_INIT_DUP;
46
+static struct string_list tag_refs = STRING_LIST_INIT_DUP;
47
static struct refspec refspecs = REFSPEC_INIT_FETCH;
48
static int anonymize;
49
static struct hashmap anonymized_seeds;
901
free(buf);
902
}
903
904
-static struct commit *get_commit(struct rev_cmdline_entry *e, char *full_name)
904
+static struct commit *get_commit(struct rev_cmdline_entry *e, const char *full_name)
905
{
906
switch (e->item->type) {
907
case OBJ_COMMIT:
932
struct rev_cmdline_entry *e = info->rev + i;
933
struct object_id oid;
934
struct commit *commit;
935
- char *full_name;
935
+ char *full_name = NULL;
936
937
if (e->flags & UNINTERESTING)
938
continue;
939
940
if (repo_dwim_ref(the_repository, e->name, strlen(e->name),
941
- &oid, &full_name, 0) != 1)
941
+ &oid, &full_name, 0) != 1) {
942
+ free(full_name);
943
continue;
944
+ }
945
946
if (refspecs.nr) {
947
char *private;
957
warning("%s: Unexpected object of type %s, skipping.",
958
e->name,
959
type_name(e->item->type));
960
+ free(full_name);
961
continue;
962
}
963
966
break;
967
case OBJ_BLOB:
968
export_blob(&commit->object.oid);
969
+ free(full_name);
970
continue;
971
default: /* OBJ_TAG (nested tags) is already handled */
972
warning("Tag points to object of unexpected type %s, skipping.",
973
type_name(commit->object.type));
974
+ free(full_name);
975
continue;
976
}
977
984
985
if (!*revision_sources_at(&revision_sources, commit))
986
*revision_sources_at(&revision_sources, commit) = full_name;
987
+ else
988
+ free(full_name);
989
}
990
991
string_list_sort(&extra_refs);