(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description spids:[12]) op: Equal rhs: {(SQ <'Test notes trees that also contain non-notes'>)} spids: [12] ) ] spids: [12] ) (C {(.)} {(./test-lib.sh)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:number_of_commits spids:[23]) op: Equal rhs: {(100)} spids: [23] ) ] spids: [23] ) (command.FuncDef name: start_note_commit body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp] children: [ (C {(test_tick)}) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(INPUT_END)} here_end_span_id: 60 stdin_parts: [ ('commit refs/notes/commits\n') ('committer ') ($ VSub_Name '$GIT_COMMITTER_NAME') (' <') ($ VSub_Name '$GIT_COMMITTER_EMAIL') ('> ') ($ VSub_Name '$GIT_COMMITTER_DATE') ('\n') ('data <<COMMIT\n') ('notes\n') ('COMMIT\n') ('\n') ('from refs/notes/commits^0\n') ('deleteall\n') ] ) ] ) ] ) ] spids: [32] ) spids: [27 31] ) (command.FuncDef name: verify_notes body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DAmp Op_DAmp Op_DAmp] children: [ (command.Pipeline children: [ (C {(git)} {(log)}) (command.SimpleCommand words: [{(grep)} {(DQ ('^ '))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(output)})] ) ] negated: F ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:i spids:[92]) op: Equal rhs: {($ VSub_Name '$number_of_commits')} spids: [92] ) ] spids: [92] ) (command.WhileUntil keyword: <KW_While while> cond: [ (command.Sentence child: (C {(Lit_Other '[')} {($ VSub_Name '$i')} {(-gt)} {(0)} {(Lit_Other ']')}) terminator: <Op_Semi ';'> ) ] body: (command.DoGroup children: [ (command.Sentence child: (command.AndOr ops: [Op_DAmp Op_DAmp] children: [ (C {(echo)} {(DQ (' commit #') ($ VSub_Name '$i'))}) (C {(echo)} {(DQ (' note for commit #') ($ VSub_Name '$i'))}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:i spids:[134]) op: Equal rhs: { (word_part.ArithSubPart anode: (arith_expr.ArithBinary op_id: Arith_Minus left: (arith_expr.ArithWord w:{($ VSub_Name '$i')}) right: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) spids: [135 140] ) } spids: [134] ) ] spids: [134] ) ] ) terminator: <Op_Semi ';'> ) ] spids: [111 144] ) redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)})] ) (C {(test_cmp)} {(expect)} {(output)}) ] ) ] spids: [70] ) spids: [65 69] ) (C {(test_expect_success)} {(DQ ('setup: create a couple of commits'))} { (SQ <'\n'> <'\n'> <'\ttest_tick &&\n'> <'\tcat <<INPUT_END >input &&\n'> <'commit refs/heads/master\n'> <'committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n'> <'data <<COMMIT\n'> <'commit #1\n'> <'COMMIT\n'> <'\n'> <'M 644 inline file\n'> <'data <<EOF\n'> <'file in commit #1\n'> <'EOF\n'> <'\n'> <'INPUT_END\n'> <'\n'> <'\ttest_tick &&\n'> <'\tcat <<INPUT_END >>input &&\n'> <'commit refs/heads/master\n'> <'committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n'> <'data <<COMMIT\n'> <'commit #2\n'> <'COMMIT\n'> <'\n'> <'M 644 inline file\n'> <'data <<EOF\n'> <'file in commit #2\n'> <'EOF\n'> <'\n'> <'INPUT_END\n'> <'\tgit fast-import --quiet <input\n'> ) } ) (C {(test_expect_success)} {(DQ ('create a notes tree with both notes and non-notes'))} { (SQ <'\n'> <'\n'> <'\tcommit1=$(git rev-parse refs/heads/master^) &&\n'> <'\tcommit2=$(git rev-parse refs/heads/master) &&\n'> <'\ttest_tick &&\n'> <'\tcat <<INPUT_END >input &&\n'> <'commit refs/notes/commits\n'> <'committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n'> <'data <<COMMIT\n'> <'notes commit #1\n'> <'COMMIT\n'> <'\n'> <'N inline $commit1\n'> <'data <<EOF\n'> <'note for commit #1\n'> <'EOF\n'> <'\n'> <'N inline $commit2\n'> <'data <<EOF\n'> <'note for commit #2\n'> <'EOF\n'> <'\n'> <'INPUT_END\n'> <'\ttest_tick &&\n'> <'\tcat <<INPUT_END >>input &&\n'> <'commit refs/notes/commits\n'> <'committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n'> <'data <<COMMIT\n'> <'notes commit #2\n'> <'COMMIT\n'> <'\n'> <'M 644 inline foobar/non-note.txt\n'> <'data <<EOF\n'> <'A non-note in a notes tree\n'> <'EOF\n'> <'\n'> <'N inline $commit2\n'> <'data <<EOF\n'> <'edited note for commit #2\n'> <'EOF\n'> <'\n'> <'INPUT_END\n'> <'\ttest_tick &&\n'> <'\tcat <<INPUT_END >>input &&\n'> <'commit refs/notes/commits\n'> <'committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE\n'> <'data <<COMMIT\n'> <'notes commit #3\n'> <'COMMIT\n'> <'\n'> <'N inline $commit1\n'> <'data <<EOF\n'> <'edited note for commit #1\n'> <'EOF\n'> <'\n'> <'M 644 inline deadbeef\n'> <'data <<EOF\n'> <'non-note with SHA1-like name\n'> <'EOF\n'> <'\n'> <'M 644 inline de/adbeef\n'> <'data <<EOF\n'> <'another non-note with SHA1-like name\n'> <'EOF\n'> <'\n'> <'M 644 inline de/adbeefdeadbeefdeadbeefdeadbeefdeadbeef\n'> <'data <<EOF\n'> <'This is actually a valid note, albeit to a non-existing object.\n'> <'It is needed in order to trigger the "mishandling" of the dead/beef non-note.\n'> <'EOF\n'> <'\n'> <'M 644 inline dead/beef\n'> <'data <<EOF\n'> <'yet another non-note with SHA1-like name\n'> <'EOF\n'> <'\n'> <'INPUT_END\n'> <'\tgit fast-import --quiet <input &&\n'> <'\tgit config core.notesRef refs/notes/commits\n'> ) } ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EXPECT_END)} here_end_span_id: 306 stdin_parts: [ (' commit #2\n') (' edited note for commit #2\n') (' commit #1\n') (' edited note for commit #1\n') ] ) ] ) (C {(test_expect_success)} {(DQ ('verify contents of notes'))} {(SQ <'\n'> <'\n'> <'\tgit log | grep "^ " > actual &&\n'> <'\ttest_cmp expect actual\n'>)} ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect_nn1)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EXPECT_END)} here_end_span_id: 332 stdin_parts: [('A non-note in a notes tree\n')] ) ] ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect_nn2)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EXPECT_END)} here_end_span_id: 343 stdin_parts: [('non-note with SHA1-like name\n')] ) ] ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect_nn3)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EXPECT_END)} here_end_span_id: 354 stdin_parts: [('another non-note with SHA1-like name\n')] ) ] ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(expect_nn4)}) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EXPECT_END)} here_end_span_id: 365 stdin_parts: [('yet another non-note with SHA1-like name\n')] ) ] ) (C {(test_expect_success)} {(DQ ('verify contents of non-notes'))} { (SQ <'\n'> <'\n'> <'\tgit cat-file -p refs/notes/commits:foobar/non-note.txt > actual_nn1 &&\n'> <'\ttest_cmp expect_nn1 actual_nn1 &&\n'> <'\tgit cat-file -p refs/notes/commits:deadbeef > actual_nn2 &&\n'> <'\ttest_cmp expect_nn2 actual_nn2 &&\n'> <'\tgit cat-file -p refs/notes/commits:de/adbeef > actual_nn3 &&\n'> <'\ttest_cmp expect_nn3 actual_nn3 &&\n'> <'\tgit cat-file -p refs/notes/commits:dead/beef > actual_nn4 &&\n'> <'\ttest_cmp expect_nn4 actual_nn4\n'> ) } ) (C {(test_expect_success)} {(DQ ('git-notes preserves non-notes'))} {(SQ <'\n'> <'\n'> <'\ttest_tick &&\n'> <'\tgit notes add -f -m "foo bar"\n'>)} ) (C {(test_expect_success)} {(DQ ('verify contents of non-notes after git-notes'))} { (SQ <'\n'> <'\n'> <'\tgit cat-file -p refs/notes/commits:foobar/non-note.txt > actual_nn1 &&\n'> <'\ttest_cmp expect_nn1 actual_nn1 &&\n'> <'\tgit cat-file -p refs/notes/commits:deadbeef > actual_nn2 &&\n'> <'\ttest_cmp expect_nn2 actual_nn2 &&\n'> <'\tgit cat-file -p refs/notes/commits:de/adbeef > actual_nn3 &&\n'> <'\ttest_cmp expect_nn3 actual_nn3 &&\n'> <'\tgit cat-file -p refs/notes/commits:dead/beef > actual_nn4 &&\n'> <'\ttest_cmp expect_nn4 actual_nn4\n'> ) } ) (C {(test_done)}) ] )