Skip to content

Commit f3fc8d9

Browse files
author
fossdd
committed
Update pijul
1 parent 193bf23 commit f3fc8d9

File tree

2 files changed

+23
-4
lines changed

2 files changed

+23
-4
lines changed

libpijul/src/pristine/sanakirja.rs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,6 +1905,7 @@ impl MutTxnT for MutTxn<()> {
19051905
}
19061906

19071907
fn drop_channel(&mut self, name0: &str) -> Result<bool, Self::GraphError> {
1908+
debug!(target: "drop_channel", "drop channel {:?}", name0);
19081909
let name = SmallString::from_str(name0);
19091910
let channel = if let Some(channel) = self.open_channels.lock().remove(&name) {
19101911
let channel = Arc::try_unwrap(channel.r)
@@ -1939,25 +1940,42 @@ impl MutTxnT for MutTxn<()> {
19391940
let mut unused_changes = Vec::new();
19401941
'outer: for x in btree::rev_iter(&self.txn, &c, None)? {
19411942
let (_, p) = x?;
1942-
for chan in self.iter_channels("").map_err(|e| e.0)? {
1943-
let (name, chan) = chan.map_err(|e| e.0)?;
1943+
debug!(target: "drop_channel", "testing unused change: {:?}", p);
1944+
let mut it0 = self.iter_channels("").map_err(|e| e.0)?;
1945+
let it1 = self.open_channels.lock();
1946+
let mut it1 = it1.iter();
1947+
loop {
1948+
let (name, chan) = if let Some(chan) = it0.next() {
1949+
chan.map_err(|e| e.0)?
1950+
} else if let Some((name, chan)) = it1.next() {
1951+
(name.as_ref(), chan.clone())
1952+
} else {
1953+
break
1954+
};
1955+
debug!(target: "drop_channel", "channel: {:?}", name);
19441956
assert_ne!(name.as_str(), name0);
19451957
let chan = chan.read();
19461958
if self
19471959
.channel_has_state(&chan.states, &p.b)
19481960
.map_err(|e| e.0)?
19491961
.is_some()
19501962
{
1963+
// This other channel is in the same state as
1964+
// our dropped channel is, so all subsequent
1965+
// patches are in use.
19511966
break 'outer;
19521967
}
19531968
if self
19541969
.get_changeset(&chan.changes, &p.a)
19551970
.map_err(|e| e.0)?
19561971
.is_some()
19571972
{
1973+
// This channel has a patch, move on.
19581974
continue 'outer;
19591975
}
19601976
}
1977+
1978+
debug!(target: "drop_channel", "actually unused: {:?}", p);
19611979
unused_changes.push(p.a);
19621980
}
19631981
let mut deps = Vec::new();
@@ -1970,7 +1988,8 @@ impl MutTxnT for MutTxn<()> {
19701988
deps.push((*k, *v));
19711989
}
19721990
for (k, v) in deps.drain(..) {
1973-
btree::del(&mut self.txn, &mut self.revdep, &k, Some(&v))?;
1991+
debug!(target: "drop_channel", "deleting from revdep: {:?} {:?}", k, v);
1992+
btree::del(&mut self.txn, &mut self.dep, &k, Some(&v))?;
19741993
btree::del(&mut self.txn, &mut self.revdep, &v, Some(&k))?;
19751994
}
19761995
}

pijul/src/commands/git.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ impl Git {
5151
let mut uncommitted = false;
5252
for i in 0..st.len() {
5353
if let Some(x) = st.get(i) {
54-
if x.path_bytes().starts_with(b".pijul") {
54+
if x.path_bytes().starts_with(b".pijul") || x.path_bytes().starts_with(b".ignore") {
5555
continue;
5656
}
5757
debug!("status = {:?}", x.status());

0 commit comments

Comments
 (0)