@@ -114,7 +114,6 @@ struct note_msg {
114
114
};
115
115
116
116
struct note_data {
117
- int given ;
118
117
int use_editor ;
119
118
int stripspace ;
120
119
char * edit_path ;
@@ -193,15 +192,15 @@ static void write_commented_object(int fd, const struct object_id *object)
193
192
static void prepare_note_data (const struct object_id * object , struct note_data * d ,
194
193
const struct object_id * old_note )
195
194
{
196
- if (d -> use_editor || !d -> given ) {
195
+ if (d -> use_editor || !d -> msg_nr ) {
197
196
int fd ;
198
197
struct strbuf buf = STRBUF_INIT ;
199
198
200
199
/* write the template message before editing: */
201
200
d -> edit_path = git_pathdup ("NOTES_EDITMSG" );
202
201
fd = xopen (d -> edit_path , O_CREAT | O_TRUNC | O_WRONLY , 0600 );
203
202
204
- if (d -> given )
203
+ if (d -> msg_nr )
205
204
write_or_die (fd , d -> buf .buf , d -> buf .len );
206
205
else if (old_note )
207
206
copy_obj_to_fd (fd , old_note );
@@ -515,7 +514,6 @@ static int add(int argc, const char **argv, const char *prefix)
515
514
516
515
if (d .msg_nr )
517
516
concat_messages (& d );
518
- d .given = !!d .buf .len ;
519
517
520
518
object_ref = argc > 1 ? argv [1 ] : "HEAD" ;
521
519
@@ -528,7 +526,7 @@ static int add(int argc, const char **argv, const char *prefix)
528
526
if (note ) {
529
527
if (!force ) {
530
528
free_notes (t );
531
- if (d .given ) {
529
+ if (d .msg_nr ) {
532
530
free_note_data (& d );
533
531
return error (_ ("Cannot add notes. "
534
532
"Found existing notes for object %s. "
@@ -690,14 +688,14 @@ static int append_edit(int argc, const char **argv, const char *prefix)
690
688
usage_with_options (usage , options );
691
689
}
692
690
693
- if (d .msg_nr )
691
+ if (d .msg_nr ) {
694
692
concat_messages (& d );
695
- d . given = !! d . buf . len ;
696
-
697
- if ( d . given && edit )
698
- fprintf ( stderr , _ ( "The - m/-F/-c/-C options have been deprecated "
699
- "for the 'edit' subcommand .\n"
700
- "Please use 'git notes add -f -m/-F/-c/-C' instead.\n" ));
693
+ if ( edit )
694
+ fprintf ( stderr , _ ( "The -m/-F/-c/-C options have been "
695
+ "deprecated for the ' edit' subcommand.\n"
696
+ "Please use 'git notes add -f - m/-F/-c/-C' "
697
+ "instead .\n"));
698
+ }
701
699
702
700
object_ref = 1 < argc ? argv [1 ] : "HEAD" ;
703
701
0 commit comments