#5459 Fix pagure.lib.git.get_changed_files()
Merged a year ago by ngompa. Opened a year ago by nforro.
nforro/pagure fix-changed-files  into  master

file modified
+4
@@ -1398,6 +1398,10 @@ 

      """Return files changed between HEAD and BASE.

      Return as a dict with paths as keys and status letters as values.

      """

+     if set(fromrev) == set("0") or set(fromrev) == set("^0"):

+         # get hash of the empty tree

+         cmd = ["hash-object", "-t", "tree", "/dev/null"]

+         fromrev = pagure.lib.git.read_git_output(cmd, abspath)

      cmd = ["diff", "--name-status", "-z", fromrev, torev]

      output = pagure.lib.git.read_git_output(cmd, abspath)

      items = output.split("\0")

@@ -3231,6 +3231,12 @@ 

          hash0 = output[0].replace("'", "")

          hash1 = output[1].replace("'", "")

  

+         # Case 0: EMPTY_TREE => hash0

+         output0 = pagure.lib.git.get_changed_files(

+             hash0, "^" + 40 * "0", gitrepo

+         )

+         self.assertEqual(output0, {issue.uid: "A"})

+ 

          # Case 1: hash1 => hash0

          output1 = pagure.lib.git.get_changed_files(hash0, hash1, gitrepo)

          self.assertEqual(output1, {issue.uid: "M"})

Handle the case when the pushed commits are the very first commits in a branch.

rebased onto 66b351c5cd491b04e45a2c2d915af0d4498527a7

a year ago

rebased onto d39aaadec2a7ec5259ded649ee5ae38d16bcb5cc

a year ago

Sorry, forgot to run the style test.

rebased onto f7faded6e941ca9d98e61e57e32f806d06034da4

a year ago

pretty please pagure-ci rebuild

a year ago

rebased onto d9d29ed81b74bf7adc9e3f9ea98820ae38d5830b

a year ago

Looks like the CI says there's some issues still:

11:22:43  =========================== short test summary info ============================

11:22:43  FAILED tests/test_pagure_flask_ui_fork.py::PagureFlaskForktests::test_request_pull_close - AssertionError: unexpectedly None

11:22:43  FAILED tests/test_pagure_flask_ui_fork.py::PagureFlaskForktests::test_request_pull_patch_close - AssertionError: unexpectedly None

11:22:43  FAILED tests/test_pagure_flask_ui_fork.py::PagureFlaskForktests::test_merge_request_pull_FF - AssertionError: unexpectedly None

11:22:43  FAILED tests/test_pagure_flask_ui_fork.py::PagureFlaskForktests::test_merge_request_pull_FF_w_merge_commit - AssertionError: unexpectedly None

11:22:43  FAILED tests/test_pagure_flask_ui_fork.py::PagureFlaskForktests::test_merge_request_pull_merge - AssertionError: unexpectedly None

11:22:43  === 5 failed, 1716 passed, 3 skipped, 143455 warnings in 3364.38s (0:56:04) ====

11:22:43  py312: exit 1 (3366.11 seconds) /pagure> pytest -n auto tests/ pid=51514
11:22:43    py39: OK (1020.40=setup[37.15]+cmd[983.25] seconds)
11:22:43    py310: OK (1014.69=setup[34.42]+cmd[980.27] seconds)
11:22:43    py311: OK (1016.59=setup[36.69]+cmd[979.90] seconds)
11:22:43    py312: FAIL code 1 (3457.05=setup[90.94]+cmd[3366.11] seconds)
11:22:43    evaluation failed :( (6508.81 seconds)
11:22:46  

rebased onto 9da9c2c01e02f03f15345bd264d8367d084bdf75

a year ago

rebased onto 81b80231ffea46f7a3fee075682a2d2b61263c25

a year ago

rebased onto 1b36cb8

a year ago

Looks like these failures are spurious, and hopefully this rebase gets rid of them.

Pull-Request has been merged by ngompa

a year ago