Re: [PATCH v2] log: Handle new repository case.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 25, 2012 at 7:13 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
> Leila Muhtasib <muhtasib@xxxxxxxxx> writes:
>
>> @@ -553,8 +562,13 @@ int cmd_log(int argc, const char **argv, const char *prefix)
>>       init_revisions(&rev, prefix);
>>       rev.always_show_header = 1;
>>       memset(&opt, 0, sizeof(opt));
>> -     opt.def = "HEAD";
>> +     opt.def = default_to_head_if_exists();
>> +
>>       cmd_log_init(argc, argv, prefix, &rev, &opt);
>> +
>> +     if (!opt.def && !rev.cmdline.nr)
>> +             return 0;
>> +
>>       return cmd_log_walk(&rev);
>
> Do you even need these four new lines if you do not error out?
> Doesn't log_walk() return successfully if there is nothing in the
> queue anyway?

Actually, yes. This was left behind because I was printing a success
message "No commit(s) to display". Thanks for catching this.

>
>> @@ -1128,7 +1142,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
>>       DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
>>       rev.subject_prefix = fmt_patch_subject_prefix;
>>       memset(&s_r_opt, 0, sizeof(s_r_opt));
>> -     s_r_opt.def = "HEAD";
>> +     s_r_opt.def = default_to_head_if_exists();
>
> I didn't think about other commands, but I do not think format-patch
> wants to silently succeed without doing anything---it is definitely
> a user error, no?
>

The other changed commands are git show, git whatchanged, git reflog.
And I think for the initial repo case, they can just silently succeed
vs display that error message.

'git format-patch' on a regular repo with commits, did nothing for me.
That's why I had originally included it. Though I think I'm changing
my mind about this because it's about generating a patch -- not just
displaying info.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]